Let's suppose I have a function foo
(define (foo)
(doargs (i) (println i)))
and I can process it by something like this:
(foo a b c x e f g)
Now, suppose I have a list that looks like this:
(set 'lst '(a b c x e f g))
Is there a method to pass 'lst to 'foo so that it is consumend
one item at a time by 'doargs?
Thanks
tim
(cons foo lst)
like this:
> (apply foo lst)
a
b
c
x
e
f
g
g
>
Quote from: "Jeff"
(cons foo lst)
> (cons foo lst)
((lambda ()
(doargs (i)
(println i))) a b c x e f g)
;; That doesn't evaluate 'foo with 'lst...
;; Or did I miss something?
Thanks
tim
we posted together ;-) the answer again:
> (apply foo lst)
a
b
c
x
e
f
g
g
>
Quote from: "Lutz"
we posted together ;-) the answer again:
> (apply foo lst)
a
b
c
x
e
f
g
g
>
Yes! Thank you sir!
Jeff just forgot to wrap an 'eval' around his answer, but there is a difference between both approaches:
(eval (cons foo lst))
This would give all nil's because a,b,c,d,e,f,g would be evaluated to their contents. It depends what you want, the contents of the symbols a to g or the symbols a to g themselves when using 'apply'.