unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* making a thunk out of a list
@ 2007-07-24 14:06 Marco Maggi
  2007-07-24 14:37 ` Thien-Thi Nguyen
  2007-09-18 22:16 ` Neil Jerram
  0 siblings, 2 replies; 4+ messages in thread
From: Marco Maggi @ 2007-07-24 14:06 UTC (permalink / raw)
  To: guile-user

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"




_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-09-18 22:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-24 14:06 making a thunk out of a list Marco Maggi
2007-07-24 14:37 ` Thien-Thi Nguyen
2007-07-24 14:47   ` Thien-Thi Nguyen
2007-09-18 22:16 ` Neil Jerram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).