Hi everyone,
I have a map like this:
(def answer42
{:world [:space :planets :stars],
:space [:spaceship :asteroid],
:spaceship [:bob :spacesuit],
:planets [:mars],
:mars [:water :base],
:base [:garden :livingroom],
:garden [:mary]})
My question is:
*How can i make a tree from it?like this:*'(:world (:space (:spaceship
(:bob :spacesuit)) (:asteroid))(:planets (:mars (:water) (:base (:garden
(:mary) (:livingroom)))))(:stars))
*or this one:*
[:world
[:space [:spaceship [:bob :spacesuit]] [:asteroid]]
[:planets [:mars [:water] [:base [:garden [:mary] [:livingroom]]]]]
[:stars]]
I've tried:
(clojure.walk/prewalk answer42 :world)
but it gives back nils:
[[[nil nil] nil] [[nil [[nil] nil]]] nil]
and also miss things without children..
This is my first post here. All your help is greatly appreciated!
Bests,
Aaron
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.