[erlang-questions] List comprehension puzzler
Richard A. O'Keefe
ok@REDACTED
Thu Sep 22 03:07:41 CEST 2016
On 21/09/16 11:23 PM, ok@REDACTED wrote:
> I'd like to point out that it's straightforward to write
> > ...
>
> It's not much harder to write
>
> length_between([_|Xs], L, U) when L > 0 ->
> length_between(Xs, L-1, U-1);
> length_between([], L, U) ->
> L =< 0, 0 =< U;
> length_between(_, _, _) ->
> false.
The third clause was *meant* to be
length_between([], L, U)
when L =< 0, 0 =< U -> true;
Free code. Worth every mill.
Thanks to Fred Hébert for noticing this.
Too much coffee, too late at night, and too much
frustration with AirPort losing the signal every
few seconds.
More information about the erlang-questions
mailing list