New version of makelist



Hi,
I have committed a new version of makelist which introduces some
extensions.

  makelist ()
  makelist (<expr>)
  makelist (<expr>, <limit>)
  makelist (<expr>, <var>, <limit>)
  makelist (<expr>, <var>, <list>)
  makelist (<expr>, <var>, <initial>, <limit>)
  makelist (<expr>, <var>, <initial>, <limit>, <increment>)

Where <var>, <initial>, <limit> and <increment> have the same meaning
as in "for <var>: <initial> thru <limit> step <increment>"

Examples:
1)  makelist(a[i]^2, a[i], c, c+3)
gives the same result as the older version:
  [c^2 , (c + 1)^2 , (c + 2)^2 , (c + 3)^2 ]

2)  makelist(a[i]^2, a[i], c, c+%pi)
used to give an error; it now gives the same result as example 1, which
is more consistent with:
  for i: c thru c+%pi do print(i^2);

3)  makelist(a[i]^2, a[i], c, c-1);
gives an empty list, which was the same result in the old version.

4)  makelist(a[i]^2, a[i], c, c-2);
used to give an error; it will now give an empty list.

New cases:
5) makelist(2*x, x, a, a - %e*%pi*b, -3*b)
        ---> [2*a, 2*(a-3*b), 2*(a-6*b)]

6) makelist(random(1.0))  ---> [.9138095996128959]

7) makelist(random(1.0), 2) ---> [.1951846177977887, .4823905248516196]

8) makelist(2*i, i, 3) ---> [2, 4, 6]

Performance:

(%i1) f1(n) := makelist(random(1.0),i,1,n)$
(%i2) f2(n) := makelist(random(1.0),i,n)$
(%i3) f3(n) := makelist(random(1.0),n)$

(%i5) f1(10^6)$
Evaluation took 15.6800 seconds (15.6790 elapsed) using 908.862 MB.
(%i6) f2(10^6)$
Evaluation took 14.6800 seconds (14.6790 elapsed) using 725.755 MB.
(%i7) f3(10^6)$
Evaluation took 6.3400 seconds (6.3390 elapsed) using 451.074 MB.

(%i8) compile(f1,f2,f3)$

(%i9) f1(10^6)$
Evaluation took 0.9100 seconds (0.9100 elapsed) using 191.669 MB.
(%i10) f2(10^6)$
Evaluation took 1.1500 seconds (1.1540 elapsed) using 191.742 MB.
(%i11) f3(10^6)$
Evaluation took 1.1500 seconds (1.1550 elapsed) using 191.737 MB.

Please try it out and report any bugs.
Regards,
Jaime