[erlang-questions] guards

Witold Baryluk baryluk@REDACTED
Sat Jul 25 18:01:38 CEST 2009


Dnia 2009-07-25, sob o godzinie 03:50 +0100, Dave Pawson pisze:
> filterHelper(Lst,Int,Result) when ((length(Lst) == 1) and
> (lists:nth(1,Lst) =< Int)) ->
>     [lists:nth(1,Lst) | Result];

filterHelper([Elem],Int,Result) when Elem =< Int ->
    [Elem | Result];

simpler and a lot faster.

-- 
Witold Baryluk <baryluk@REDACTED>



More information about the erlang-questions mailing list