On Sun, Jul 10, 2011 at 4:51 PM, octopusgrabbus
<octopusgrab...@gmail.com> wrote:
> If the function is called with one argument, what Clojure language
> rule allows x to appear outside the vector brackets?

([x] x)

The x outside of the vector brackets is the value being returned.

So if max is called with only a single argument, that is also the
returned value.

All of the function definitions have values outside of the vector
brackets (the vector brackets are what represent a specific definition
of the function).

For example:

([x y] (if (> x y) x y))

So in the vector brackets, you've got x and y, which represent 2
values being passed in.  Outside fo the vector brackets you've got a
conditional.  if the first argument (x) is greater than the 2nd (y),
return x.  otherwise, return y.

(if (> a b)  ;; if a > b
     a ;; return a
     b ;; otherwise, return b
))

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love
my wife. And I wish you my kind of success.

-- 
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

Reply via email to