On Dec 6, 11:58 pm, Ken Wesson <kwess...@gmail.com> wrote:
> On Tue, Dec 7, 2010 at 2:15 AM, javajosh <javaj...@gmail.com> wrote:
> > Mike and I have had a nice off-line conversation where we enumerated
> > the possible things that can come after open-parens. I listed 7, he
> > added 3:
>
> >> 1. A value (if the paren has a tick '(  )
> >> 2. A function.
> >> 3. A map - which is a psuedo function that takes a key as an arg.
> >> 4. A keyword - which is a psuedo function that takes a map as an arg.
> >> 5. A macro. This is the normal case, I think. Looking through the mailing
> >> list, it appears that most clojure programming questions revolve around
> >> which one of the hundreds of macros to invoke and in which order!
> >> 6. The Java form: (MyClass. )
> >> 7. The java method form (.doSomething)
> > 8. A function returning a function to invoke - ((find-my-function) )
> > 9. A loop - (recur )
> > 10. The anonymous function macro: #( )
>
> > So, at least I know why I feel uneasy about open paren! It's super
> > overloaded.
>
> Not really. (...) is a non-atomic s-expression. If it's evaluated
> unquoted, the first nested s-expression is evaluated and if it's not
> callable an exception is thrown. Macros, special forms (which are sort
> of like system-internal macros and are used to build all the other
> macros, and functions), Java constructors, Java methods, and functions
> are callable (and maps and keywords -- also vectors -- act as
> functions for this purpose).

So, to paraphrase: "all of those things act like functions, parens
just call functions, so parens aren't overloaded." ..Which is about
two steps away from a tautology.  :)

Anyway, I'm aware that open-parens is the signal to Invoke or Call
something in Clojure - and therefore anything after the parens is
Callable. It is the incredible diversity of 'Things I Can Invoke' that
makes the parens difficult to a newb. (Although, I have to say,
enumerating the possibilities is helping me immensely.)

As an aside, it would be nice if there was some code convention to
distinguish between macros and functions, just as there is a
convention for identifying globals. (doc something) gets to be rather
tedious to type.

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