guile-user
[Top][All Lists]
Advanced

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

srfi-72


From: Stefan Israelsson Tampe
Subject: srfi-72
Date: Fri, 18 Jan 2013 23:36:12 +0100

Heya guilers!

I just packaged a small package to enable a reader extension #.
that should be a replacement of #, in #` syntactic forms.

The #. form will pick up the sourunding syntactic environment inside
any #` forms specified e.g. consider

Example (from the srfi-72 documentation):

(use-module (ice-9 syntax-closure))
(let-syntax ((main (lambda (form)                       
                       (define (make-swap x y)
                         (quasisyntax 
                          (let ((t #,x))
                            (set! #,x #,y)
                            (set! #,y   t))))
                       
                       (quasisyntax
                        (let ((s 1)
                              (t 2))
                          #.(make-swap #`s #`t)
                          (list s t))))))
  (main))

==> (2 1)
In this example #`s will refer to the let bound 's'  which is not the case
if we instead would have used #, #`s would refere to an outer 's'

If we instead had used #, the swap would not happend.

You may find it at
http://gitorious.org/syntax-closures/syntax-closures

Have fun!

/Stefan

reply via email to

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