Re: Clojure for the Brave and True - infix notation exercise

2016-06-26 Thread Botond Balázs
Thanks miner! On Friday, June 24, 2016 at 10:20:54 PM UTC+2, miner wrote: > > Not exactly the same problem, but you might like to see an infix > implementation from “The Joy of Clojure” by Fogus and Chouser. > > http://fogus.me/fun/unfix/infix-src.html > > The “Joy” code makes intermediate calc

Re: Clojure for the Brave and True - infix notation exercise

2016-06-26 Thread Botond Balázs
Thank you Jason, this is indeed a much nicer solution. On Friday, June 24, 2016 at 8:51:26 PM UTC+2, Jason Felice wrote: > > Recursive descent parsers are much smaller for simple cases. Basically, > you write one function per level of precedence, and each tries, greedily, > to consume as much a

Re: Clojure for the Brave and True - infix notation exercise

2016-06-24 Thread Steve Miner
Not exactly the same problem, but you might like to see an infix implementation from “The Joy of Clojure” by Fogus and Chouser. http://fogus.me/fun/unfix/infix-src.html The “Joy” code makes intermediate calculations as it goes. I tweaked it a bit to make a data-reader that only does the infix

Re: Clojure for the Brave and True - infix notation exercise

2016-06-24 Thread Jason Felice
Recursive descent parsers are much smaller for simple cases. Basically, you write one function per level of precedence, and each tries, greedily, to consume as much as possible for that level of precedence. e.g. (defn parse-level1 ;; + and - [list] ... ; calls parse-level2 repeatedly so long

Clojure for the Brave and True - infix notation exercise

2016-06-24 Thread Botond Balázs
Hi, I'm working through Clojure for the Brave and True and there's a little exercise at the end of Chapter 7 : Create an infix function that takes a list like (1 + 3 * 4 - 5) and > transforms it into the lists that Clojure needs in order to correctly