Syntax is throughing my understanding off.

Bengt Kleberg <>
Wed Sep 22 07:44:03 CEST 2004


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