[erlang-questions] Function clause question
Camille Troillard
tuscland@REDACTED
Fri Dec 26 01:17:35 CET 2008
Dear list,
I have a simple best practices question:
Is it better to write:
skip ([_H | _T] = Arg, Bin) ->
skip_count (length (Arg) + 1, Bin);
skip (<<Arg/binary>>, Bin) ->
skip_count (size (Arg), Bin).
or
skip (Arg, Bin) when is_list (Arg) ->
skip_count (length (Arg) + 1, Bin);
skip (Arg, Bin) when is_binary (Arg) ->
skip_count (size (Arg), Bin).
I would be in favor or the second case, but I wonder if the use of guards in
this case is a very good idea.
Best,
Cam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081226/6e65917d/attachment.htm>
More information about the erlang-questions
mailing list