drclj <deepikaro...@gmail.com> writes:

> Thanks everyone, in the apply function source code I see
>
> ([^clojure.lang.IFn f args]
> (. f (applyTo (seq args))))
>
> Seems the (applyTo (seq args)) returns arg parameters,
>
> And the f is invoked only once:
>
> (. f args)

I think you’re missing that `.` is a special form with special
evaluation rules.  The following forms are all equivalent:

    (. f (applyTo (seq args))
    (. f applyTo (seq args))
    (.applyTo f (seq args))

With the last being syntactic sugar converted during macro-expansion to
the middle form.

So there’s no `applyTo` *function*, just the `applyTo` *method* of IFn
instance `f`.

OOC, do you have a background using R or similar languages?  I was
confused myself learning R, because what R calls `apply` is nothing like
what Lisps call `apply` and (as others in this thread pointed out) is
more similar to what Clojure calls `map`.

-Marshall

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to