For functions where the order of sentences is unimportant, is it the base case of the latter:
all(Pred, [Head|Tail]) -> case Pred(Head) of true -> all(Pred, Tail); false -> false end; all(Pred, []) when is_function(Pred, 1) -> true.
Or the base case:
all(Pred, []) when is_function(Pred, 1) -> true; all(Pred, [Head|Tail]) -> case Pred(Head) of true -> all(Pred, Tail); false -> false end.
From looking at the source code in the standard library, it seems that the convention is basic. Is this the preferred style? Is there a reason for this, or is it the way it is?
source share