guile-user
[Top][All Lists]
Advanced

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

Re: Closure, syntax and load ...


From: Miroslav Silovic
Subject: Re: Closure, syntax and load ...
Date: 30 Aug 2001 15:25:56 +0200

Manuel Giraud <address@hidden> writes:

> Here is the first version :

At this point, I took a liberty of properly indenting your file:

;;; foo.scm

(use-syntax (ice-9 syncase))
(define f 0)
(let ()
  (define square
    (lambda (x)
      (* x x)))
  (define-syntax foo
    (lambda (x)
      (syntax-case x ()
                   ((_ a)
                    (syntax (square a))))))
  (set! f (foo 6)))

It's obvious that foo is defined within let and isn't visible outside
foo.scm (or, for that matter, outside let itself). You might want to
do this:

(use-syntax (ice-9 syncase))
(define f 0)
(define-syntax foo
  (lambda (x)
    (syntax-case x ()
                 ((_ a)
                  (syntax (square a))))))
(let ()
  (define square
    (lambda (x)
      (* x x)))
  (set! f (foo 6)))

-- 
How to eff the ineffable?



reply via email to

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