Re: Strange behavior of the #() macro

2008-10-23 Thread Chouser
On Thu, Oct 23, 2008 at 11:55 AM, R. P. Dillon <[EMAIL PROTECTED]> wrote: > > Very clear explanation - I guess I thought that it would be possible > to to do the equivalent of (constantly 3) using the macro. I was just > overlooking the arity issue with the reduce call. It's possible, but ugly.

Re: Strange behavior of the #() macro

2008-10-23 Thread R. P. Dillon
Very clear explanation - I guess I thought that it would be possible to to do the equivalent of (constantly 3) using the macro. I was just overlooking the arity issue with the reduce call. Thanks for taking the time to explain! Cheers, Rick --~--~-~--~~~---~--~~

Re: Strange behavior of the #() macro

2008-10-23 Thread mb
Hi Rick, First of all: #(x) is equivalent with (fn [] (x)). So as an example with reduce: user=> (reduce #(+ %1 %2) (range 1 101)) 5050 user=> (reduce (fn [x y] (+ x y)) (range 1 101)) 5050 So it should be obvious, that #(3) throws exception as soon as it is called, since it is equivalent to (fn