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.
gyro@UKULELE.REASONING.COM (Scott Layson Burson) (11/14/90)
Date: 11 Nov 90 18:16:55 GMT From: Michael Pak <BOOJUM.HUJI.AC.IL!misha@ucbvax.berkeley.edu> How do you write the following Scheme code in Common Lisp: (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... Thus: (defun foo (func) #'(lambda (bar) (funcall func (funcall func (funcall func bar))))) (funcall (funcall (funcall (foo #'foo) #'foo) #'1+) 0) It returns 3^27. I let it run for a few minutes and it only got to ~67e6. That suggests it would take a couple of decades to complete. Is that consistent with what you know? -- Scott