From: Pascal J. Bourguignon on 5 Apr 2010 16:57 Mirko <mirko.vukovic(a)gmail.com> writes: > I evidently missed stating the crucial part. I wanted run-time > compilation - the lambda will exist only briefly. > [...] > Pascal's post pointed me to `compile', and that has done the trick. > Now I am off to carefully read the hyperspec section. Notice that if you call the lambda only once, and it's a simple function as in the example, it will be more lightweight in general to use COERCE rather than COMPILE. Or even just EVAL: (let ((arg-value 42) (expression '(/ arg 2))) (eval `(let ((arg ,arg-value)) ,expression))) -- __Pascal Bourguignon__
From: Mirko on 5 Apr 2010 19:27
On Apr 5, 4:57 pm, p...(a)informatimago.com (Pascal J. Bourguignon) wrote: > Mirko <mirko.vuko...(a)gmail.com> writes: > > I evidently missed stating the crucial part. I wanted run-time > > compilation - the lambda will exist only briefly. > > [...] > > Pascal's post pointed me to `compile', and that has done the trick. > > Now I am off to carefully read the hyperspec section. > > Notice that if you call the lambda only once, and it's a simple function > as in the example, it will be more lightweight in general to use COERCE > rather than COMPILE. Or even just EVAL: > > (let ((arg-value 42) > (expression '(/ arg 2))) > (eval `(let ((arg ,arg-value)) ,expression))) > > -- > __Pascal Bourguignon__ Thanks. In my case, the lambda will be used O(10^5) times so I will stick with compile for now. |