I am learning LISP through several books. One of them is "Metamagical
Themas" by Douglas Hofstaeder (OK, it's just a pop intro, but you gotta
start somewhere.)
In his introduction to defining functions he gives me
(def rac (lambda (lyst) (car (reverse lyst))))
which gives me:
error: unbound function - def
if continued: try evaluating symbol again
if I try :
(defun rac (lambda (lyst) (car (reverse lyst))))
from another book, I get:
error: bad formal argument list.
What am I doing wrong????
Teleny, friend of cats.
> In his introduction to defining functions he gives me
>
> (def rac (lambda (lyst) (car (reverse lyst))))
> which gives me:
>
> error: unbound function - def
In Common Lisp, you would write this as:
(defun rac (lyst) (car (reverse lyst)))
In Scheme you could use:
(define rac (lambda (lyst) (car (reverse lyst))))
or:
(define (rac lyst) (car (reverse lyst)))
Arthur Lemmens
Arthur Lemmens wrote:
> > In his introduction to defining functions he gives me
> >
> > (def rac (lambda (lyst) (car (reverse lyst))))
> > which gives me:
> >
> > error: unbound function - def
>
> In Common Lisp, you would write this as:
> (defun rac (lyst) (car (reverse lyst)))
>
> In Scheme you could use:
> (define rac (lambda (lyst) (car (reverse lyst))))
> or:
> (define (rac lyst) (car (reverse lyst)))
Perhaps I should have made it clear that "lyst" is being used as a dummy
variable...
teleny, friend of cats.
In article <·················@connix.com>, teleny <······@connix.com> wrote:
>
>
>Arthur Lemmens wrote:
>
>> > In his introduction to defining functions he gives me
>> >
>> > (def rac (lambda (lyst) (car (reverse lyst))))
>> > which gives me:
>> >
>> > error: unbound function - def
>>
>> In Common Lisp, you would write this as:
>> (defun rac (lyst) (car (reverse lyst)))
>>
>> In Scheme you could use:
>> (define rac (lambda (lyst) (car (reverse lyst))))
>> or:
>> (define (rac lyst) (car (reverse lyst)))
>
>Perhaps I should have made it clear that "lyst" is being used as a dummy
>variable...
Why? It's already clear from the code you posted, and irrelevant to the
error you were asking about (which had to do with "def", not "lyst").
--
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.