nchubrich wrote: > Is there any way to access the clojure parser, i.e. something that > gives you all the elements contained in an expression? I.E. (parse (+ > 1 2)) would give you something like [:list [[:symbol +] [:literal 1] > [:literal 2]]].
Do you mean the reader? user=> (read-string "(+ 1 2)") (+ 1 2) user=> (first (read-string "(+ 1 2)")) + user=> (type (first (read-string "(+ 1 2)"))) clojure.lang.Symbol user=> (type (second (read-string "(+ 1 2)"))) java.lang.Integer Or perhaps quote is what you're looking for? user=> (second '(+ 1 2)) 1 There's no need for a syntax like [:list [[:symbol +]]] etc as (+ 1 2) literally is just a list of a symbpl and two Integers, you just need to use quote to tell Clojure not to evaluate 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. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---