Re: Clojure Partial Evaluator

2009-07-20 Thread kyle smith
Sounds like a cool project. Have you thought about adding peephole optimization? For example, the form (map inc (map inc (range 1000))) should be equivalent to (map #(+ 2 %) (range 1000)). I believe there are automated methods, but it could even be as simple as a pattern- matching, rule-based t

Re: Clojure Partial Evaluator

2009-07-20 Thread Tim Snyder
Thanks for the interest. As Meikel said, the point is to move the computation to compile time. But it goes a little deeper than that. You can imagine any program as a set of operations on data. Some of this data is known at compile time and some is only known at run time. Partial evaluation tr

Re: Clojure Partial Evaluator

2009-07-20 Thread Nicolas Oury
Hi, it sounds interesting. There is some non trivial interactions between lambda-reductions and effects/time. For example, (defn f [x] (+ x x)) (fn [y] (par-eval (f (do increase-a-counter 1))) will change the semantic of the code. On a different level, if you copy two times a long calculus, the

Re: Clojure Partial Evaluator

2009-07-20 Thread Meikel Brandmeyer
Hi, On Jul 20, 3:48 pm, Mark Volkmann wrote: > I'm trying to understand what's going on here and whether the example > above demonstrates a real speed improvement. Isn't it the case that > fibb30* essentially computes the result before the timer on the last > line begins? That's essentially th

Re: Clojure Partial Evaluator

2009-07-20 Thread Mark Volkmann
On Sun, Jul 19, 2009 at 10:08 PM, Tim Snyder wrote: > > I completed a 0.1 version of a Clojure partial evaluator.  It consists > of a macro "par-eval" that analyses the form it is passed and replaces > all the sub-forms that can be reduced at macro-expand time with th

Clojure Partial Evaluator

2009-07-20 Thread Tim Snyder
I completed a 0.1 version of a Clojure partial evaluator. It consists of a macro "par-eval" that analyses the form it is passed and replaces all the sub-forms that can be reduced at macro-expand time with their reduced versions, provided a printable form exists. It can be obtaine