guile-user
[Top][All Lists]
Advanced

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

making a thunk out of a list


From: Marco Maggi
Subject: making a thunk out of a list
Date: Tue, 24 Jul 2007 16:06:31 +0200

Ciao,

  maybe this is simple, but today I cannot find a solution;
while iterating over the nodes of a graph I can accumulate
in a list the sequence of function invocations upon each
node (pseudo-code):

  (let ((result '()))
     ;; for each node in the iteration:
     (set! result (cons (list action-upon-node node)
                        result))
     ;; at the end
     (reverse result))

I do it in a method to memoize the iteration; now I
would like to make a thunk out of the list, the following
works:

  (lambda () (for-each primitive-eval result))

but I would like a thunk that does not use FOR-EACH. I fail
to see how to do it with a macro, and I cannot APPLY a
LAMBDA, for example the following does not work:

    ((list lambda '() result))

Ideas?

--
Marco Maggi

"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"






reply via email to

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