list comprehension question
Håkan Stenholm
hakan.stenholm@REDACTED
Thu Jul 28 21:51:33 CEST 2005
Charles Blair wrote:
>in something like this:
>
>[X || X <- lists:seq(1,25)]
>
>is the result guaranteed to reflect the order of the generator
>
You'll get [1,2,3,4, ... , 25] as expected (I at least have never seen
anything else), but I can't see that the documentation guarantees this
in any formal way - except that all examples act in this way and that
all listcomprehension code I have ever seen appears to assume this.
>, or
>not?
>
>i'm working with a list of randomly generated results, and i want to
>print them in the order in which they were generated--is lists:foreach
>the way to go here? a list comprehension would be simpler to write and
>nicer to look at.
>
>thanks.
>
>
>
>
>
>
More information about the erlang-questions
mailing list