Robert Dodier wrote:
>I'm not sure what you want, but it seems likely you want this
>custom loop to be a macro function (defined by ::=).
Your suggestion works! (well, on my other question)
m:[1,2,3];
f(expr) ::= apply('create_list, [expr,i,1,3]);
f(m[i]);
[1, 2, 3];
Now I need to figure out why...
I still may end up doing Mma Table in lisp by hacking
create_list. Table allows a non-unit step in the iteration,
which create_list does not. (I got it by using 'subst' to
replace i by something like 2*i in expr and then using
create_list). I think it may be possible to allow specifying
a step in create_list in a backward compatible way. So this
way, I could possibly kill two birds with one stone-- implementing
Table and adding useful functionality to create_list.
One problem is, create_list currently allows this
create_list(expr,i,i1,i2,j,j1,j2),
so how do you do this
create_list(expr,i,i1,i2,istep)
without confusing istep with j ?
This won't work
create_list(expr,i,[i1,i2,istep])
because that syntax is already used for supplying an explicit
list of values for i.
But I think this will work without breaking anything
create_list(expr,[i,i1,i2,istep],[j,j1,j2,jstep])
On the other hand, this means that merely adding a step specification
requires supplying arguments is a very different form, which is
probably not good interface design. Maybe just a different function
entirely (like 'table') is the way to go.
John