mit-scheme-devel
[Top][All Lists]
Advanced

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

Re: [MIT-Scheme-devel] For your amusement


From: Joe Marshall
Subject: Re: [MIT-Scheme-devel] For your amusement
Date: Fri, 17 Jun 2011 11:03:43 -0700

On Fri, Jun 17, 2011 at 10:50 AM, Taylor R Campbell <address@hidden> wrote:
>   Date: Fri, 17 Jun 2011 10:34:21 -0700
>   From: Joe Marshall <address@hidden>
>
>   I remember the main reason I didn't want to make this the default.
>   I had wanted to use the Y operator to find the fixed-point and I
>   expected Liar to `tame' it.  Unfortunately, Liar isn't compiling the
>   Y operator correctly, so I tried self-application instead.
>
> What goes wrong?

(define Y
  (lambda (f)
    ((lambda (d) (d d))
     (lambda (x) (f (lambda args (apply (x x) args)))))))


(define (testit x)
  ((Y (lambda (fact)
        (lambda (n)
          (if (< n 2)
              1
              (* n (fact (-1+ n))))))) x))

1 ]=> (load "y.scm")

;Loading "y.scm"... done
;Value: testit

1 ]=> (testit 8)

;Value: 40320

1 ]=> (load "y.bin")

;Loading "y.bin"... done
;Value: testit

1 ]=> (testit 8)

;Value: 40320

1 ]=> (load "y.com")

;Loading "y.com"... done
;Value: testit

1 ]=> (testit 8)

;The object #[false 29 #x20c47c700000001] is not applicable.
;To continue, call RESTART with an option number:
; (RESTART 2) => Specify a procedure to use in its place.
; (RESTART 1) => Return to read-eval-print level 1.

2 error>

> I presume it's a different problem from the obscure
> closure analysis bug I fixed a year and a half ago?

I haven't investigated yet.

-- 
~jrm



reply via email to

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