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.
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
--~--~-~--~~~---~--~~
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