How to ignore unnecessary arguments?

Viewed 3132

Is there simple way ho to ignore unnecessary arguments?

For example: (#(+ %1 %2) 1 2) returns 3

I would like to force this code

(#(+ %1 %2) 1 2 3)

to returns 3 too. But it returns

java.lang.IllegalArgumentException: Wrong number of args (3) passed to.

How to change #(+ %1 %2)?

I hope there is some more elegant way than #(+ (nth %& 0) (nth %& 1)).

4 Answers
Related