Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves

2011-09-08 Thread octopusgrabbus
Thanks. Something got out of whack when I copied it. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post

Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves

2011-09-08 Thread Lee Spector
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

Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves

2011-09-08 Thread octopusgrabbus
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 Group

Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves

2011-09-08 Thread octopusgrabbus
http://www.cis.upenn.edu/~matuszek/cis554-2010/Assignments/clojure-01-exercises.html -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please

Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves

2011-09-08 Thread Ivan Krechetov
Which exercises are those? Are they online somewhere? On Sep 7, 11:38 pm, octopusgrabbus wrote: > When I started learning Clojure, I did not want to be a casual user that > shyed away from Clojure's native syntax, preferring to do as much as > possible in Java. To that end, I discovered some gra

Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves

2011-09-08 Thread octopusgrabbus
Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email

Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves

2011-09-08 Thread Lee Spector
You can certainly do this without zippers. Here's one simple way: (defn skeleton [tree] (map skeleton (filter seq? tree))) This style of recursion consumes memory proportionate to the depth of the tree, and will run out for enormously deep trees. But for reasonable trees it should be fine

Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves

2011-09-08 Thread octopusgrabbus
This isn't a request to get help w/ a 4Clojure problem, and I am not specifically asking for help with producing the skeleton (the tree structure without the leaves) of the sequences show below, although I would be appreciative of help. Instead I am asking if a solution to do this is simple or

Re: How To Empty A Tree or Returning The Skelton of A Tree Without Leaves

2011-09-07 Thread Bob Shock
I am confused by your question. If you are looking for help on a 4clojure problem, you may post to the new Google 4clojure group (http://groups.google.com/group/4clojure). If not, please give more details on the skeleton of a tree problem and I'm sure someone here can help. On Sep 7, 3:38 pm, oct

How To Empty A Tree or Returning The Skelton of A Tree Without Leaves

2011-09-07 Thread octopusgrabbus
When I started learning Clojure, I did not want to be a casual user that shyed away from Clojure's native syntax, preferring to do as much as possible in Java. To that end, I discovered some graduate computer science Clojure exercises and started working them. I know about 4Clojure, but these