scheme

What is "Call By Name"?

Hi to everyone! I'm working in a homework, and the professor asked me to implement the evaluation strategy called "call by name" in scheme in a certain language that we developed and he gave us an example at http://www.scala-lang.org/node/138 in the scala language, but i don't understand in what consists the call by name evaluation stra...

What are the best free Scheme implementations that you know about on Windows?

When I wrote best I meant: Speed, Have an IDE, a debugger, Compiling to machine code or some other language, Quality of implementation and, Completeness. ...

Experiences teaching or learning map/reduce/etc before recursion?

As far as I can see, the usual (and best in my opinion) order for teaching iterting constructs in functional programming with Scheme is to first teach recursion and maybe later get into things like map, reduce and all SRFI-1 procedures. This is probably, I guess, because with recursion the student has everything that's necessary for iter...

What is the difference between 1 and '1 in Lisp?

I had never really thought about whether a symbol could be a number in Lisp, so I played around with it today: > '1 1 > (+ '1 '1) 2 > (+ '1 1) 2 > (define a '1) > (+ a 1) 2 The above code is scheme, but it seems to be roughly the same in Common Lisp and Clojure as well. Is there any difference between 1 and quoted 1? ...

Why do all procedures have to be defined before the compiler sees them?

For example, take a look at this code (from tspl4): (define proc1 (lambda (x y) (proc2 y x))) If I run this as my program in scheme... #!r6rs (import (rnrs)) (define proc1 (lambda (x y) (proc2 y x))) I get this error: expand: unbound identifier in module in: proc2 ...This code works fine though: #!r6rs (import (rnr...

mutation...........

I'm kinda confused..... (define m (list 1 2 3 '(5 8))) (let ((l (cdr m))) (set! l '(28 88))) ==>(1 2 3 (5 8)) (define o (list 1 2 3 '(5 8))) (let ((l (cdr o))) (set-car! l '(28 88))) ==> (1 (28 88) 3 (5 8)) Why does (set! l '(28 88))) not update m? ...

MIT Scheme on the Mac: When I type the single quote key I get an acute accent character

I am running MIT Scheme on Snow Leopard. The problem is: when I type single quote (') I get the acute accent character (´) instead. That makes it almost impossible to program in Scheme, because I can't quote symbols, lists etc. I got MIT Scheme from Mac Ports, but the same thing happens on MIT Scheme downloaded from http://ftp.gnu.org/g...

Can someone explain the concept of 'hygiene' to me (I'm a scheme programmer)?

So... I'm new to scheme r6rs, and am learning macros. Can somebody explain to me what is meant by 'hygiene'? Thanks in advance. ...

Find all paths from root to leaves of tree in Scheme

Given a tree, I want to find the paths from the root to each leaf. So, for this tree: D / B / \ A E \ C-F-G has the following paths from root (A) to leaves (D, E, G): (A B D), (A B E), (A C F G) If I represent the tree above as (A (B D E) (C (F G))) then the function g does the trick: (define (paths tree) (cond ...

Why does using cons to create a pair of two lists produce a list and two elements?

I've started learning Scheme, for fun mostly, and because I've never used a functional language before. I chose Scheme because I wanted to read SICP for a long time. Anyway, I'm currently learning about lists, and before that I learned about cons, car and cdr. And there's an example that creates a list of lists with cons, like this : ...

Help with dynamic-wind and call/cc

I am having some trouble understanding the behavior of the following Scheme program: (define c (dynamic-wind (lambda () (display 'IN)(newline)) (lambda () (call/cc (lambda (k) (display 'X)(newline) k))) (lambda () (display 'OUT)(newline)))) As I understand, c will be bound to th...

Would Lisp be extremely difficult for a new(ish) programmer to learn?

I've got a little experience with Python (enough to where I can do if/else/elif and some random number generation), but I've always had a weird fascination with the Lisp languages. I downloaded some scheme source code to look at the syntax but it was pretty much gibberish to me. For a programmer with only a little programming experience...

When did the idea of macros (user-defined code transformation) appear?

I have read McCarthy's 1960 paper on LISP and found no reference to anything that's similar to user-defined macros or normal order evaluation. I was wondering when marcos first appeared in programming language history (and also in Lisp history): When was the idea of user-defined code transformation (before interpretation or compilation...

Normal order and applicative order evaluation in Scheme

Hi All, For the 1st example given on site: View-Site, my understanding is that normal order evaluates to [6;1;1] and applicative order evaluates to [6;2;2] Can anyone please confirm my assessment? Regards, darkie ...

DrRacket, R5RS and the error procedure.

I love DrRacket IDE (formerly DrScheme) but currently i'm building a pet project where i would like to be independent from it, meaning i'm commited to use only R5RS standard procedures. The thing is, in DrRacket there's this procedure called "error" which i would like to continue using but i can't find it in the Standards. What i woul...

What can be the use of SymbolType in Python?

Here's the SymbolType package that adds symbols to Python. Can those who have done anything useful with Lisp/Scheme tell me what how can I take advantage of this type in Python? Can it be used to isolate strings coming from outside (from the web) from internal code? $ sudo easy_install SymbolType $ ipython Unfortunately, you can't us...

Scheme result of a function

Hello, I have met the following code in Scheme: (define x! (lambda(x) (if (= x 1) 1 (* x (x! (- x 1)))))) (define fact x!) (define x! (lambda (x) x)) (fact 5) Everything is clear for me until re-defining x! and seeing the result of the function (20). How can it be explained?.. Why is it 20 and not 5!= 120. Thanks in advance...

Scheme, When to use Symbols instead of Strings?

I apologize in advance for my primitive english; i will try my best to avoid grammatical errors and such. Two weeks ago i decided to freshen my knowledge of Scheme (and its enlightnings) whilst implementing some math material i got between hands, specifically, Regular Languages from a course on Automata theory and Computation in which ...

Clojure or Scheme bayesian classification libraries?

Any pointers to scheme/racket or clojure bayesian classification libraries? I need one for a toy/learning project that I'm going to do. ...

Mechanism of a function in Scheme

Hello! Here it is a strange function in Scheme: (define f (call/cc (lambda (x) x) ) ) (((f 'f) f) 1 ) When f is called in the command line, the result displayed is f . What is the explanation of this mechanism ?.. Thanks! ...