Re: Recursive lets

2012-05-30 Thread nicolas.o...@gmail.com
> I agree with the other commenters that letfn is good when you can use > it, but here you can't use it. Your general approach is really the > best you can do, though it's nicer to use promise/deliver than atom/ > swap!, since these values are never going to change again. I was looking for somethi

Re: Recursive lets

2012-05-29 Thread Alan Malloy
On May 29, 9:54 am, "nicolas.o...@gmail.com" wrote: > Is there a way to write something like: > > (let [x (foo1 (fn []  (bar y))) >       y  (foo2 x)]   ) > > where the y on line 1 refers to y in line 2? > > I currently use an atom and an affectation to "tie the loop"... I agree with the othe

Re: Recursive lets

2012-05-29 Thread Tassilo Horn
"nicolas.o...@gmail.com" writes: Hi Nicolas, > Is there a way to write something like: > > (let [x (foo1 (fn [] (bar y))) > y (foo2 x)] ) > > where the y on line 1 refers to y in line 2? You can define mutual recursive local functions using `letfn`, if that's what you are trying t

Re: Recursive lets

2012-05-29 Thread Philip Potter
letfn allows mutually recursive definitions. You could combine that with trampoline. Phil Sent using thumbs, apologies for brevity On May 29, 2012 6:54 PM, "nicolas.o...@gmail.com" wrote: > Dear all, > > Is there a way to write something like: > > (let [x (foo1 (fn [] (bar y))) > y (foo2

Recursive lets

2012-05-29 Thread nicolas.o...@gmail.com
Dear all, Is there a way to write something like: (let [x (foo1 (fn [] (bar y))) y (foo2 x)] ) where the y on line 1 refers to y in line 2? I currently use an atom and an affectation to "tie the loop"... Best, Nicolas. -- You received this message because you are subscribed to