[erlang-questions] Function Declaration Syntax

Justus <>
Fri May 13 11:43:25 CEST 2011


Hi all,

I come to a question on function declaration syntax: why does function
name appear in each clause?

Name(Pattern11,...,Pattern1N) [when GuardSeq1] ->
    Body1;
...;
Name(PatternK1,...,PatternKN) [when GuardSeqK] ->
    BodyK.

It does not provide any information, except that one might make silly mistakes.

If omitting it, a new problem is how to indent clauses properly and
beautifully.

Name(Pattern11,...,Pattern1N) [when GuardSeq1] ->
    Body1;
    (PatternK1,...,PatternKN) [when GuardSeqK] ->
    BodyK.

-- 
Best Regards,
Justus



More information about the erlang-questions mailing list