Syntax is throughing my understanding off.

Edward Ing <>
Thu Sep 23 03:51:08 CEST 2004


Okay,

In most programming languages I work with, the name of a function is a
'symbol'.   And characters like " ' " are tokens which demarcate a literal
in between. Is it the case that erlang evaluating '#text#' to make up the
function name symbol?

----- Original Message ----- 
From: "Bengt Kleberg" <>
To: <>
Sent: Wednesday, September 22, 2004 1:44 AM
Subject: Re: Syntax is throughing my understanding off.


> Edward Ing wrote:
> > Hi,
> > I am new to Erlang and I am trying to learn to use it to manipulate XML.
> > I am lookng into the source files and see this definition:
> >
> > '#text#'(Text) ->
> >     export_text(Text).
> >
> > I cannot find any reference material to explain what this means, the
> > '#text#'(Text).
> >
> > Obviously it is defining a function, but what is how do you invoke this
> > function? Is '#text#' some kind of macro substitution?
>
> 1 you call the function like an ordinary function:
>
> '#text#'("a text").
>
> (or F = '#text', F("a text"), etc.)
>
>
> 2 it is not a macro. (macros are accessed with '?' ,ie ?A_MACRO). what
> is happening is the creation of an _atom_ . atoms are usually small
> letters, numbers and '_', but they can be anything. you just have to
> single quote (') them. eg 'This is an atom!'
>
>
> bengt




More information about the erlang-questions mailing list