New function - makelist alternative: table()ing Lisp ECL 9.4.1



> Hi,
>
> create_list is the function to be used:
>
> Maxima 5.18.1 http://maxima.ibuted under the GNU Public License.  
> See the file COPYING..net
> Using Lisp ECL 9.4.1
> Distributed under the GNU Public License. See the file COPYING.
> Dedicated to the memory of William Schelter.
> The function bug_report() provides bug reporting information.
> (%i1) makelist(i,i,1,1000000)$
> Evaluation took 22.2890 seconds (22.4950 elapsed)
> (%i2) makelist(i,i,1,1000000)$
> Evaluation took 24.7490 seconds (24.8120 elapsed)
> (%i3) create_list(i,i,1,1000000)$
> Evaluation took 1.3010 seconds (1.3050 elapsed)
> (%i4) create_list(i,i,1,1000000)$
> Evaluation took 1.2680 seconds (1.2960 elapsed)
>
> create_list is also rather powerful; and the speed-up is enormous once
> nested lists are created like create_list([i,j], i,1,1000, j,1,1000).
>
> Oliver

Wow create_list is fast! I've glanced through it's code, but I  
haven't yet figured out how it evaluates the expression so quicly...
Has anybody any hints on that?
$table uses (mbinding (vars values) (meval expr))... Is there a  
faster way?
I would very much like to make $table as fast as create_list..

However - multiple iterators are handeled differently in $table and  
$create_list. The last one creates a flat list of expressions, while  
$table creates a nested list of evaluated expressions which is more  
powerfull and flexible. Sadly right now, Maxima's function $flatten  
is not as advanced as Mathematica's
http://reference.wolfram.com/mathematica/ref/Flatten.html
http://reference.wolfram.com/mathematica/ref/FlattenAt.html

I would like to see Maxima's $flatten to be extended into this  
direction (while perserving it's default behaviour as it is).  
Mathematicas Flatten[] with options is a very powerful tool for  
manipulating lists. Perhaps someday when I understand Lisp enough, I  
will do it :)

Using flatten with option to which level to flatten, output of $table  
can be made identical to that of create_list, no problem, while  
perserving $table's superior iteration facilities. Of course  
create_list and makelist cannot simply be removed, even if $table  
gives a 'more-than-equal' featureset with the 'same-or-better-speed'  
for compatibility reasons.

So any hints how create_list works so fast? Or what is the fastest  
way to evaluate an expression with bound values in maxima?

Regards,
Ziga Lenarcic