guile-user
[Top][All Lists]
Advanced

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

progv in scheme


From: Panicz Maciej Godek
Subject: progv in scheme
Date: Tue, 13 Sep 2011 15:54:03 +0200

Hello,
Is there any clever way of binding values to the list of unknown
symbols in scheme?

In common lisp there is a form "progv" that takes the list of symbols
and their corresponding values and binds them within the body of
progv.

It is possible to do it using eval, like this:
(define (bind-and-eval symbols values body)
(eval `((lambda ,symbols ,body) . ,values)
      (interaction-environment)))
(define-syntax let-symbols
(syntax-rules ()
  ((_ symbols values (body ...))
   (bind-and-eval symbols values (quote (body ...))))))

but using eval for this just seems too heavy. Is there any way of
doing it that would be more legal?

Best regards,
M.



reply via email to

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