Re: Newbie: Optional parameters without multiple definitions

2008-11-15 Thread Craig Andera
If you're cool with passing a map instead of plain parameters, you could use destructuring to do this: (defn test1 [{x :x, y :y, :or {:y 3}}] [x y]) (test1 {:x 2}) => [2 3] Another thing you could do would be to use variable arity and handle the absence of the other parameters in the me

Newbie: Optional parameters without multiple definitions

2008-11-15 Thread samppi
Is there a more concise way of expressing an optional parameter with a default other than writing another entire definition? That is, instead of: (defn a-function ; two parameters, x and y, and y is 23 by default ([x] (a-function x 23) ([x y] ...)) ...is it possible to do something lik