Executing boolean expressions on a list
    Vladimir Sekissov 
    svg@REDACTED
       
    Fri Mar 14 11:01:28 CET 2003
    
    
  
Good day,
spearce> 	recursive(N, [H | T]) -> somef(N, H) and recursive(N,
T);
                                                     ^^^
spearce> 	recursive(N, []) -> true.
spearce> 
spearce> but was worried about order of evaluation on the and operator
spearce> and not being able tail-recursive.
recursive(N, [H | T]) -> somef(N, H) andalso recursive(N, T);
                                     ^^^^^^^
recursive(N, []) -> true.
This variant would be the right answer. `andalso' calculates it's right
part only if the left is true (as in C,Perl, etc).
Best Regards,
Vladimir Sekissov
    
    
More information about the erlang-questions
mailing list