Re: Clojure code optimizer

2012-04-06 Thread Sanel Zukan
Very good solution :) To continue this discussion, feel free to mail me; we will also reduce some noise here on the list. Sanel On Friday, April 6, 2012 6:47:37 PM UTC+2, Andru Gheorghiu wrote: > > It's ok now. The problem was in the let of the optimize function... > initially I had: > (let

Re: Clojure code optimizer

2012-04-06 Thread Andru Gheorghiu
It's ok now. The problem was in the let of the optimize function... initially I had: (let [reduced (reverse (into nil (eval-deep exprs)))] because exprs was a lazy sequence and I wanted to turn it into a list. I replaced the "(reverse (into nil ..." part with "(apply list ..." and it works just f

Re: Clojure code optimizer

2012-04-06 Thread Sanel Zukan
This looks really nice; good work! To force evaluation of lazy constructs, you can use 'doall' and 'dorun'. Can you show the snippet with this problem? Sanel On Thursday, April 5, 2012 1:19:32 AM UTC+2, Andru Gheorghiu wrote: > > Sorry for dropping off the radar, I was caught up in some homewor

Re: Clojure code optimizer

2012-04-05 Thread Andru Gheorghiu
Sorry for dropping off the radar, I was caught up in some homework for college. I've written a very simple program for a limited form of constant folding: ; Forces evaluation of an expression or returns the expression if ; it can be evaluated (defn force-eval [exprs] (try (eval exprs) (catch

Re: Clojure code optimizer

2012-03-22 Thread Andru Gheorghiu
  b)) > > > > here it could rewrite whole block as: > > > >  (if something > > >    1) > > > > or even can recognize Clojure patterns like: > > > >  (apply + (range 1 10)) > > > > where the pattern matching approach could rewrite e

Re: Clojure code optimizer

2012-03-21 Thread Daniel Gagnon
> > This isn't a big issue, as recursive functions aren't much advised in > Clojure. However, ideal solution would be to detect tail calls and rewrite > block in loop/recur combo. This would allow Clojure to fully reuse TCO > without waiting for JVM to implement it (which will probably never happen

Re: Clojure code optimizer

2012-03-21 Thread Sanel Zukan
posal. > Of > > course, taking some expert system approach and doing Kibit-style > matching > > can be a good starting point too :) > > > > Also, if you are interested to take tree shaking way, a good starting > point > > can be SBCL alpha shaker athtt

Re: Clojure code optimizer

2012-03-20 Thread Andru Gheorghiu
ut the code is quite easy to follow. > > Sanel > > > > > > > > On Saturday, March 17, 2012 10:59:44 PM UTC+1, Andru Gheorghiu wrote: > > > Hello, > > > I am a third year student majoring in computer science and I am > > interested in the Clojure code o

Re: Clojure code optimizer

2012-03-19 Thread Sanel Zukan
tation, but the code is quite easy to follow. Sanel On Saturday, March 17, 2012 10:59:44 PM UTC+1, Andru Gheorghiu wrote: > > Hello, > > I am a third year student majoring in computer science and I am > interested in the Clojure code optimizer project proposed for GSoC > 2012.

Re: Clojure code optimizer

2012-03-19 Thread David Nolen
On Sat, Mar 17, 2012 at 5:59 PM, Andru Gheorghiu wrote: > Hello, > > I am a third year student majoring in computer science and I am > interested in the Clojure code optimizer project proposed for GSoC > 2012. Could you please give more details (or examples) on the types of >

Clojure code optimizer

2012-03-18 Thread Andru Gheorghiu
Hello, I am a third year student majoring in computer science and I am interested in the Clojure code optimizer project proposed for GSoC 2012. Could you please give more details (or examples) on the types of optimizations the optimizer should be able to do? Also, what is a tree shaker