[erlang-questions] noob namespace question
Thu Dec 13 23:04:48 CET 2012
Yes, Erlang is definitely much closer to Lisp-2 than Lisp-1, especially as you can functions with the same name and different number of arguments (arity) and they are different functions. Don't stretch the analogy too far though. It is NOT that the functions are properties of the name (atom). To uniquely identify a function you need its module name, function name and arity, often written a M:F/A. Erlang doesn't have packages in the CL sense, there is only only one atom space containing all atoms.
----- Original Message -----
> From: "Rustom Mody" <rustompmody@REDACTED>
> To: "Thomas Allen" <thomas@REDACTED>
> Cc: "Erlang Users' List" <erlang-questions@REDACTED>
> Sent: Wednesday, 12 December, 2012 7:40:26 PM
> Subject: Re: [erlang-questions] noob namespace question
> 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
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions