instead of using binding and eval, you can generate a (fn ) form, eval it, keep the result function stuffed away somewhere and apply it instead of calling eval all the time
On Fri, Jan 23, 2009 at 1:10 PM, Zak Wilson <zak.wil...@gmail.com> wrote: > > It does seem like a legitimate use for eval, at least at first glance. > The biggest problem is that using eval this way is really slow when > each rule is being tested on hundreds of inputs. > > Interesting alternative, Konrad. I can probably take advantage of the > fact that all of the functions I'm calling (unchecked math and bitwise > operators) take exactly two arguments. I might give something like > that a try. I'd rather not though, if I can avoid it. > > It seems like there ought to be a way to make a function out of a list > of symbols that would be a valid function body and then call it > repeatedly. I was playing around with that approach at first, but > never managed to get it right. I strongly suspect creating a function > once and calling it 400 times will be faster than calling eval 400 > times. > > > -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---