Subject: New function - makelist alternative: table()
From: Žiga Lenarčič
Date: Sun, 10 May 2009 22:37:52 +0200
On 10. May, 2009, at 8:58 PM, Stavros Macrakis wrote:
> Thanks, ?iga, this looks like a nice function. Thanks for
> contributing it.
>
> The only incompatibilities I've found so far with makelist are:
>
> makelist(i,i,a,a+2) => [a, a+1, a+2]
> table(i, [i,a,a+2]) => error
> table(i, [i,%i,%i+2]) => similarly, error
> makelist(a[i],[a[i],2,3]) => [2,3]
> table => error
Ok I inspected $makelist..
$makelist takes the difference of 'end' and 'start' via 'sub*' and
iterates over that. It complains if the difference is not an integer.
It can be added to $table I think, with support for noninteger
differences ($numberp differences). I will try to do something along
these lines.
The complex case though is wierd though - iteration is not defined as
well as in real number cases.. It can be made to work, but I fear it
is somewhat confusing...
The case of a[i] brings up a question - right now $table checks the
first element (variable) of the iterator with $symbolp. How should I
check it to allow a[i], but not some wierd cases (like sin(x))?
Regards,
Ziga Lenarcic