Re: unconditional append to end

2014-02-07 Thread Travis Moy
(into [] coll) :a > "Elapsed time: 16224.79319 msecs" > nil > On Friday, February 7, 2014 9:26:05 PM UTC-8, puzzler wrote: > > On Fri, Feb 7, 2014 at 9:08 PM, Travis Moy > > wrote: > >> Surprisingly it looks like (concat coll '(:a)) is faster than (co

Re: unconditional append to end

2014-02-07 Thread Travis Moy
You should use a vector, but it's also possible to use concat. For example, (concat '(1 2 3) [4]) will give you (1 2 3 4). This made me curious as to the best way to get a collection into vector, so I played around with it some: user=> (def r 10) > #'user/r > user=> (def coll (range 1))

Re: Parsing Clojure with instaparse: how to handle special forms?

2014-02-07 Thread Travis Moy
orth it's trivial > to produce a grammar which can _parse_ valid clojure code. _Reading_ > clojure code from such a parse tree is and should be an entirely seperate > concern, implemented as a pass over the generated parse structure. > > - Reid > > On Thursday, February

Parsing Clojure with instaparse: how to handle special forms?

2014-02-06 Thread Travis Moy
I'm trying to use instaparse to parse Clojure code so that I can reformat it, but I'm having an issue with how to handle special forms. Should I attempt to parse special forms such as let and defn into their own rules, or should I rely instead on the actual content of the terminal to determine