It would be nice if the compiler handled these things with greater
cleverness. In the mean time, some macros might be in order.

I'd also like to add that clojure.core is not generally an exemplar of style. :)

-Per

On Wed, Mar 24, 2010 at 11:58 PM, Sean Devlin <francoisdev...@gmail.com> wrote:
> It's a (drastic) performance improvement.  The magic number of 3
> appears to cover a lot of use cases.  Once you get larger than three,
> it typically is a large number of inputs, i.e. the tail flattens off.
>
> On Mar 23, 5:00 pm, Thomas <thomas.g.kristen...@gmail.com> wrote:
>> Hi all,
>>
>> I've been reading through clojure.core to see examples of fine clojure
>> style. One thing I've noticed is (what I consider) a weird notation
>> when parsing parameters for function. As an example, consider the
>> function juxt:
>>
>> (defn juxt
>>   "Alpha - name subject to change.
>>   Takes a set of functions and returns a fn that is the juxtaposition
>>   of those fns.  The returned fn takes a variable number of args, and
>>   returns a vector containing the result of applying each fn to the
>>   args (left-to-right).
>>   ((juxt a b c) x) => [(a x) (b x) (c x)]"
>>   ([f]
>>      (fn
>>        ([] [(f)])
>>        ([x] [(f x)])
>>        ([x y] [(f x y)])
>>        ([x y z] [(f x y z)])
>>        ([x y z & args] [(apply f x y z args)])))
>> [ rest of juxt is omitted for brevity ]
>>
>> I don't understand why there needs to be a case for [x], [x y], [x y
>> z] and [x y z & args]. Why not just [args]? And why the magic number
>> (three) of variables?
>>
>> Thomas
>
> --
> 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
> Note that posts from new members are moderated - please be patient with your 
> first post.
> 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
>
> To unsubscribe from this group, send email to 
> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to