I don't think that's the question here: x and y are each their own kind of argument, followed by zero or more same-kinded arguments. Take dissoc as an example and compare with select-keys.
On Wednesday, March 6, 2013 12:54:13 PM UTC+1, Achint Sandhu wrote: > > I personally think the first (current) approach is better since it ensures > that the abstraction is not leaky from a caller's perspective, e,g. as a > user I want to be able to type (+ 1 2 3 4 5) instead of (+ 1 2 [3 4 5]). > The fact that the last 3 arguments end up as a collection inside the > implementation of the function being called is a detail that should not > leak through to the caller of the code. > > If forced to pass a collection, I'd much rather be typing (+ [1 2 3 4 > 5])since it's consistent. > > Cheers, > Achint > > On Wednesday, March 6, 2013 6:45:38 AM UTC-5, Dave Sann wrote: >> >> a minor thing. >> >> which do you prefer? >> >> (defn blah [x y & zs] ...) , or, (defn blah [x y zs] ...) >> >> >> >> clojure core usually uses the first form. assoc, conj and so forth >> >> I have used this because it seems nicer for the caller >> >> (blah x y z1 z2 z3) rather than (blah x y [z1 z2 z3]) >> >> >> However, if you regularly use this you end up with apply calls all over >> the place. >> >> so, >> >> (defn other-blah [x & zs] ...) >> >> (defn blah [x y & zs] >> ... >> (apply other-blah x zs)) >> >> >> >> If you use the second form you can pass straight through - which seems to >> decrease code noise. >> >> (defn other-blah [x zs] ...) >> >> (defn blah [x y zs] >> ... >> (other-blah x zs)) >> >> and looks better to me. >> >> >> >> Dave >> >> >> >> -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
