misha@BOOJUM.HUJI.AC.IL (Michael Pak) (11/12/90)
Hello there, gurus of Scheme AND Common Lisp.
How do you write the following Scheme code in Common Lisp:
------- cut here --------
(define (foo func)
(lambda (bar) (func (func (func bar))))))
((((foo foo) foo) 1+) 0) ;See the spoiler at the end to see what does
; this cute little thing return...
------- cut here -------
I have tried many ways to implement this in Common Lisp, but every time
it says that something else is wrong. I have just begun studying Common Lisp,
and this thing was the first I wanted to try.
Thanks a lot.
Misha.
Spoiler:
It returns 3^27.moore%cdr.utah.edu@cs.utah.edu (Tim Moore) (11/13/90)
In article <.658347415@boojum> misha@BOOJUM.HUJI.AC.IL (Michael Pak) writes: >Hello there, gurus of Scheme AND Common Lisp. > > How do you write the following Scheme code in Common Lisp: > >------- cut here -------- >(define (foo func) > (lambda (bar) (func (func (func bar)))))) > >((((foo foo) foo) 1+) 0) ;See the spoiler at the end to see what does > ; this cute little thing return... >------- cut here ------- (defun foo (func) #'(lambda (bar) (funcall func (funcall func (funcall func bar))))) (funcall (funcall (funcall (foo #'foo) #'foo) #'1+) 0) >I have tried many ways to implement this in Common Lisp, but every time >it says that something else is wrong. I have just begun studying Common Lisp, >and this thing was the first I wanted to try. > This is good example of an program which can be expressed more compactly in Scheme than in Common Lisp. Tim Moore moore@cs.utah.edu {bellcore,hplabs}!utah-cs!moore "Ah, youth. Ah, statute of limitations." -John Waters