views:

241

answers:

1

Are the square brackets around arguments in Clojure's defn, defmacro and binding (am I forgetting some?) really creating a vector or is it just a matter of syntax, making the arguments stand out from the rest?

I'm reading Clojure in Action which states:

Clojure uses vectors to denote function arguments or binding forms.

which made me ask this question here.

+10  A: 

Yes, it is really a vector. We can see that by building a function manually and then evaluating it:

(eval (list (list 'fn (vector 'x) (list '* 'x 2)) 100))
;=> 200

Hope that helps.

fogus
Great, thanks :)
Michiel Borkent