I've been looking into Clojure and now Scheme for a while. Currently
it's been SICP.
I notice that SICP has examples of recursion such as a binary tree
builder that is something like the following:
(define (tree top elements split-value)
(cons (tree (filter (< split-value) elements) )
(tree (filter (>= split-value) elements )))
))
This is just something I threw in here and is not real code. The point
is that tree makes two calls to itself.
For a large number of elements, there will be approx ((log base 2)
elements) recursive calls to "tree".
In clojure, would this be possible? Wouldn't it produce a stack overflow
with big enough input? Would there be a way to define it in terms of
recur, loop, etc?
Apologies if this is too obvious.......
John Holland
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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