On Sun, Dec 28, 2008 at 6:18 AM, Mark Engelberg
<[email protected]> wrote:
>
> One thing that really bothers me about this code is that step and
> increment should really be locally defined within expand (this would
> also eliminate the need to pass around v-original-seqs everywhere),
> but without letrec, I don't see any easy way to do this, because step
> needs to refer to itself. This seems like a good example of why
> Clojure would benefit from letrec.
I certainly wouldn't argue against Clojure getting letrec, but until
that day you can provide a name the 'fn' form for use within the
function. This allows the (slightly repetitive) pattern:
(defn str-up-to [n]
(let [foo (fn foo [i]
(str i ","
(when (< i n)
(foo (inc i)))))]
(foo 0)))
Note there are much better ways to do the useless thing that str-up-to
does here.
--Chouser
g
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---