guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: two elementary questions -- corrected


From: Johan Georg Granström
Subject: Re: two elementary questions -- corrected
Date: Tue, 11 Dec 2001 21:09:33 +0100

> 1.  What is the difference in meaning between these two expressions?
>
> (lamdba x  x)
> (lambda (x) x)

The first one gives you a list of all arguments in x,
the second takes one argument x.

> 2. I've been doing the exercises in a learning-scheme book, and one is
> to implement the "list" function.  What is wrong here?
>
> (define (list . x)
> (cond
> ((null? x) '())
> ((null? (cdr x)) x)
> (else (cons (car x) (list (cdr x))))))
>
> (list 1 2 3 4) => (1 (2 3 4)), but I want (1 2 3 4).

Why not (define list (lambda x x))

- Johan Granström





reply via email to

[Prev in Thread] Current Thread [Next in Thread]