[erlang-questions] Function Declaration Syntax

Attila Rajmund Nohl <>
Fri May 13 17:01:26 CEST 2011


The (usual) problem is that this is not consistent. You have to write
the function name for different function clauses, but must not write
the 'fun' for different clauses in anonymous functions. I would prefer
the 'fun' anu anonymous functions too.

2011/5/13, Alexander Krasnukhin <>:
> Think about it not as whole function but as set of clauses. It make sense
> this way.
>
> On Fri, May 13, 2011 at 11:43 AM, Justus <> wrote:
>
>> 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
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
>
>
> --
> Regards,
> Alexander
>



More information about the erlang-questions mailing list