[erlang-questions] noob namespace question
Rustom Mody
rustompmody@REDACTED
Wed Dec 12 19:40:26 CET 2012
On Thu, Dec 13, 2012 at 12:00 AM, Thomas Allen <thomas@REDACTED> wrote:
> On Wed, Dec 12, 2012 at 11:44:43PM +0530, Rustom Mody wrote:
> > I dont understand. Let me try and be more explicit about my concern.
> >
> > Let h be a higher-order function of one argument (h/1)
> >
> > Now in the call h(foo)
> > How does Erlang know whether foo is a function or an atom?
>
> This is not valid, and you will get a "bad function" error if you try to
> pass your function this way. You must create a "fun" like so:
>
> h(fun foo/0)
>
> Similarly, you could pass an anonymous fun (like fun(X) -> X end), or
> a module-function combination (like fun lists:reverse/1).
>
>
Thanks Thomas that answers succinctly.
In Lisp terminology Erlang is more like a Lisp-2 than a Lisp-1
http://en.wikipedia.org/wiki/Common_Lisp#The_function_namespace
--
http://www.the-magus.in
http://blog.languager.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121213/441a4c13/attachment.htm>
More information about the erlang-questions
mailing list