Re: Standard calling-a-function function?

2009-10-22 Thread Timothy Pratley
On Oct 22, 3:22 pm, John Harrop jharrop...@gmail.com wrote: user= (map call (map constantly [1 2 3])) (1 2 3) map call and map constantly are actually inverse operations. :) that makes me smile! --~--~-~--~~~---~--~~ You received this message because you

Re: Standard calling-a-function function?

2009-10-22 Thread RandyHudson
(apply arg) On Oct 21, 7:49 pm, samppi rbysam...@gmail.com wrote: Is there a standard function that takes one argument and calls it? That is, the function equivalent to #(%). Or is that the best idiom there is? --~--~-~--~~~---~--~~ You received this message

Re: Standard calling-a-function function?

2009-10-22 Thread samppi
That is indeed nice. Thanks for the code; I guess I don't really have to settle for #(%) after all. @RandyHudson: apply would work, but it's pretty slow, and not worth switching from #(%). On Oct 21, 11:49 pm, Timothy Pratley timothyprat...@gmail.com wrote: On Oct 22, 3:22 pm, John Harrop

Re: Standard calling-a-function function?

2009-10-21 Thread James Reeves
apply On Oct 22, 12:49 am, samppi rbysam...@gmail.com wrote: Is there a standard function that takes one argument and calls it? That is, the function equivalent to #(%). Or is that the best idiom there is? --~--~-~--~~~---~--~~ You received this message because

Re: Standard calling-a-function function?

2009-10-21 Thread samppi
Ah, of course. But then I'm afraid of a time penalty cost, because apply can take many arguments; would this be significant? Or should I stick to #(%)? Clojure 1.0.0- user= (def a (constantly 55)) #'user/a user= (time (dotimes [_ 500] (a))) Elapsed time: 0.389 msecs nil user= (time (dotimes [_

Re: Standard calling-a-function function?

2009-10-21 Thread James Reeves
I think you need to be careful not to prematurely optimise. If using apply becomes a problem, then drop in something more efficient, but until that point there's no reason not to use it. - James On Oct 22, 1:27 am, samppi rbysam...@gmail.com wrote: Ah, of course. But then I'm afraid of a time

Re: Standard calling-a-function function?

2009-10-21 Thread John Harrop
On Wed, Oct 21, 2009 at 7:49 PM, samppi rbysam...@gmail.com wrote: Is there a standard function that takes one argument and calls it? That is, the function equivalent to #(%). Or is that the best idiom there is? #(%) is only four characters. Calling apply with only one argument also does

Re: Standard calling-a-function function?

2009-10-21 Thread samppi
Oh, no. I was just wondering if there was a standard variable devoted to it. A symbol would be aesthetically less clutter than #(%), even if it'd take more typing. But if there isn't any other than the slow apply function, I'm happy with #(%) too. :) On Oct 21, 6:33 pm, John Harrop

Re: Standard calling-a-function function?

2009-10-21 Thread John Harrop
On Wed, Oct 21, 2009 at 11:50 PM, samppi rbysam...@gmail.com wrote: Oh, no. I was just wondering if there was a standard variable devoted to it. A symbol would be aesthetically less clutter than #(%), even if it'd take more typing. But if there isn't any other than the slow apply function,

Re: Standard calling-a-function function?

2009-10-21 Thread John Harrop
On Thu, Oct 22, 2009 at 12:19 AM, John Harrop jharrop...@gmail.com wrote: On Wed, Oct 21, 2009 at 11:50 PM, samppi rbysam...@gmail.com wrote: Oh, no. I was just wondering if there was a standard variable devoted to it. A symbol would be aesthetically less clutter than #(%), even if it'd take