[erlang-questions] noob namespace question
Wed Dec 12 19:27:44 CET 2012
On Dec 12, 2012, at 13:14, Rustom Mody <> wrote:
> On Wed, Dec 12, 2012 at 11:30 PM, Loïc Hoguin <> wrote:
> On 12/12/2012 06:58 PM, Rustom Mody wrote:
> In Erlang variables start with a capital letter, atoms start with a
> lowercase letter.
> Functions also start with lowercase.
> How does Erlang distinguish atoms and functions? Especially in the
> context of higher order functions.?
> [Disclaimer: noob to Erlang but not functional programming or Lisp.
> Erlang atoms look quite close to Lisp atoms though also different...]
> Function names are atoms.
> Funs don't have a name (yet) so there's no naming happening there.
> 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?
Syntactic context :)
Parser is a state machine that interprets tokens based on current parse state/context.
Generally, I like to think of atoms as first class building blocks that references to modules and functions (among other things) can be constructed out of.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions