[erlang-questions] lists:seq/[2,3] bug?

Nicolas Charpentier nc@REDACTED
Thu Sep 18 09:05:47 CEST 2008


Richard A. O'Keefe wrote:
 > On my Mac I have Erlang R12B-3.
 > erl -version says
 > Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 5.6.3
 >
 > lists:seq(1, N) gives me the expected N-element list for
 > integers N >= 1.  I expect, indeed, I would require, that
 > lists:seq(1, 0) should give me the empty list.  Instead,
 >

Hi,

According to the documentation, the meaning of the first argument is the 
first value and the second one is the *final* value of the sequence not 
the length of the sequence.
I think that your proposition will break a lot of code.


Some example of lists:seq usage.

Erlang (BEAM) emulator version 5.6.3 [source] [smp:2] [async-threads:0] 
[hipe] [kernel-poll:false]

Eshell V5.6.3  (abort with ^G)
1> lists:seq(2,3).
[2,3]
2> lists:seq(2,0,-1).
[2,1,0]
3>


Regards,
---
Nicolas Charpentie



More information about the erlang-questions mailing list