[erlang-questions] how to quelch lc warnings?

Ulf Wiger (TN/EAB) <>
Thu Apr 12 15:02:17 CEST 2007


 
Richard Carlsson wrote:
> 
> There is a simple way of suppressing the warning: insert a 
> dummy generator that controls how many repetitions you want:
> 
>      [X || _<-[1], ...Tests...]
> 
> if Tests fail, you get [], otherwise [X]. This can be used 
> for duplication as well:
> 
>      [X || _<-[1,2], ...Tests...]
> 
> will yield [] or [X,X], and
> 
>      [X || _<-lists:seq(1,N), ...Tests...]
> 
> yields [] or [X, ..., X] (X repeated N times).


That's probably a nice convention, also indicating
that you didn't just forget the generator.

BR,
Ulf W




More information about the erlang-questions mailing list