[erlang-questions] case or clause

Robert Raschke rtrlists@REDACTED
Fri Jan 9 10:04:16 CET 2009

2009/1/8 Sten Kvamme <sten@REDACTED>:
> I got the question the other day about erlang best practize, to use case
> or clause? (don't know if clasuse is the correct erlang name, but you
> know -- in a Prolog-way).
> Is erlang better/faster/leaner if I implement several "prolog" clauses
> as a case in a clause, or is it better/faster/leaner to reduce the use
> of case to situations when local variables in a clause is used in the
> case statement?
> Or is it just a matter of 'taste'?

One thing to bear in mind is that error messages arising from nested
cases can be hard to decipher sometimes. I try to keep my functions
simple enoug, not to run into this.

So, a function that would normally have a case within a case, I tend
to rewrite as a function with multiple heads and only one case inside,
where needed.


More information about the erlang-questions mailing list