Hi, Colin.

I don't use 'partial' that much either, since anonymous functions are so 
easy to create.  A fn also has the advantage (to my mind) of making it 
clear what arity the old and new fns have.  'Partial' turns a multi-arity 
fn into another multi-arity fn, which I personally think is very hard to 
translate when reading code, even if you're familiar with the original fn.

I don't have any parameter order rules, either.  I just use the argument 
order of whichever clojure.core fn reminds me most of the fn I'm writing 
("This is like a reduction, I'll put the collection at the end; This adds 
an element, I'll put the collection at the beginning.").

--Leif

On Wednesday, April 30, 2014 11:22:55 PM UTC-4, Colin Fleming wrote:
>
> Hi everyone,
>
> After the very interesting keyword argument debate, I have another 
> question about API design. Specifically I'm interested in suggestions about 
> parameter order. The new API guidelines, which have changed very recently 
> to favour maps over keyword args, also changed to include a suggestion that 
> the keyword map be the first argument, since it's the "least variance" 
> argument. 
>
> I've been using some fairly simple rules to order my parameters, basically 
> 1) functions that operate on collections should have the collection last to 
> interoperate with ->>, and 2) functions operating on a "main" object should 
> accept that first, to interoperate with ->. #2 is generally pretty 
> intuitive since it's the same as Java interop and protocol calls, but 
> there's still a fair amount of ambiguity with just these rules unless all 
> your functions have one or two arguments.
>
> I'm interested in opinions about the "variance" ordering, since I assume 
> this is to facilitate use of partial and the like. I never really use 
> partial myself so I don't have a good feeling for how this ordering should 
> work - any comments or opinions?
>
> Thanks,
> Colin
>

-- 
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to