[erlang-questions] List comprehension question
Tue May 27 13:40:04 CEST 2014
On Mon, May 26, 2014 at 3:50 AM, Dmitry Kolesnikov
> Your fist suggestion fails in shell with
> * 1: variable 'NC' unsafe in 'case' (line 2)
Yes, the compiler isn't smart enough to realize the false case will prevent
further evaluation. It's a false warning.
> The last suggestion with two generators looks pretty cool.
> I’ve got an impression that its complexity is N * log(N).
Why N * log(N)? With two generators, the complexity is O(N * M), but M, in
this case, is 1 so it should still be very close to O(N).
I'm glad you found the method useful, though.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions