Works fine for me. Here it is in a leiningen REPL session:
$ lein repl
REPL started; server listening on localhost port 53116
user=> (defn skeleton
[tree]
(map skeleton (filter seq? tree)))
#'user/skeleton
user=> (def test_data1 '(1 (2 3) ( ) (( )) :a))
#'user/test_data1
user=> (skeleton test_data1)
(() () (()))
The recursion ends when the tree argument contains no subsequences, in which
case filter returns an empty sequence and you are mapping skeleton down nothing
(so it doesn't get called).
-Lee
On Sep 8, 2011, at 2:35 PM, octopusgrabbus wrote:
> Lee:
>
> I tried
>
> (defn skeleton
> [tree]
> (map skeleton (filter seq? tree)))
>
> with
>
> (def test_data1 '(1 (2 3) ( ) (( )) :a))
>
> and got a Java out of memory error.
>
> Where is the condition end recursion condition?
>
> tnx
> cmn
>
> --
> 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
--
Lee Spector, Professor of Computer Science
Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
[email protected], http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438
--
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