guile-user
[Top][All Lists]
Advanced

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

Binding symbols in stages


From: Hans Aberg
Subject: Binding symbols in stages
Date: Sat, 6 Mar 2010 10:03:00 +0100

In order to do currying via C++ functions*), I might use something like an evaluator that evaluates an unbound symbol to itself. Is that possible?

Translated into Scheme code, it corresponds to defining say
  (define add (lambda (x) (lambda (y) (+ x y))))
by
  (define add1 (lambda (y) (+ x y)))
and then
  (define add (lambda (x) ...))
Thus in two separate steps, where the unbound symbol x in the first expression is bound only in the second.

I use now
scm_eval(scm_list_3(scm_sym_lambda, x, y), scm_interaction_environment())
where x is a list of symbols and y an expression.

  Hans

*) See the code at http://math.su.se/~haberg/guile/






reply via email to

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