[erlang-questions] List comprehension puzzler
Lloyd R. Prentice
lloyd@REDACTED
Thu Sep 22 03:33:41 CEST 2016
Hi Richard,
I finally had a chance to look closely at the ISBN validator function you sent me. It looks terrific, definitely addresses issues I would not have considered.
So many thanks for taking the time to point the way.
And thanks to all others who posted insights and suggestions.
All the best,
Lloyd
Sent from my iPad
> On Sep 21, 2016, at 9:07 PM, Richard A. O'Keefe <ok@REDACTED> wrote:
>
>
>
>> 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.
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list