bgnori / broom

golang practice.
1 stars 0 forks source link

Multi-Arity Func­tions #14

Open bgnori opened 10 years ago

bgnori commented 10 years ago

複数の引数とbodyの組を持つことができるようにする.

(defn foo (x) (x y)) 的なコード

Variadic Function (defn foo [x & xs])とも混在できる.

リンク先はdefprotocolの話だがdestructringできる状況は関数とletと同じようだ.

This is not supported, for the reasons Stuart Sierra gives. To go into a little more detail, the & symbol is special only in a destructuring context like let or function arguments. As Stuart makes clear, defprotocol is not such a context.