[erlang-questions] lists:seq/3 strange behaviour

Bartłomiej Puzoń <>
Tue Jun 15 14:04:24 CEST 2010


This behaviour is actually described in lists manual:

"Failure: If To<From-Incr and Incr  is positive,
  or if To>From-Incr and Incr is negative, 
  or if Incr==0 and From/=To."

If you drop this assumptions, their algorithm for lists:seq (meant to be fast?) may not stop 
(according to the lists source code).



----- "Piotr Kaleta" <> escribió:

> What was the reason for lists:seq function to be implemented in a way
> 
> that if you call:
> 
> lists:seq(2, 1, 10)
> 
> it works as expected returning an an empty list, while when beeing 
> called like:
> 
> lists:seq(20, 1, 10)
> 
> it throws an exception?
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:

-- 
Bartłomiej Puzoń
Erlang Solutions

---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-questions mailing list