shhyou / ypsilon-fork

Automatically exported from code.google.com/p/ypsilon
Other
0 stars 0 forks source link

Macro not working which relies on internal define context having letrec* semantics #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
my-letrec.sps:
--------------
#!r6rs
(import (rnrs))

(define-syntax my-letrec
  (syntax-rules ()
    [(_ ([v e] ...) . b)
     (let ()
       (define t (list e ...))
       (define v (let ([v (car t)]) (set! t (cdr t)) v))
       ...
       . b)]))

(write
 (my-letrec ([f (lambda (x) (g x 2))]
             [g (lambda (x y) (+ x y))])
   (f 1)))
(newline)
--------------

$ ypsilon my-letrec.sps 

error: #<closure 0xb5717ad0> expected 2, but 1 argument given

irritants:
  (1)

It relies on the (list e ...) being evaluated in a scope which includes the
v ... bindings established by the (define v ---) ... .

Original issue reported on code.google.com by derick.e...@gmail.com on 1 Aug 2008 at 2:41

GoogleCodeExporter commented 9 years ago
Thank you for your bug report!

Original comment by y.fujita...@gmail.com on 2 Aug 2008 at 4:54

GoogleCodeExporter commented 9 years ago
I have fixed the bug and trunk directory is updated. Please try.
Thank you!

Original comment by y.fujita...@gmail.com on 5 Aug 2008 at 4:51