On Sat, Mar 21, 2009 at 6:40 PM, Stavros Macrakis <macrakis at alum.mit.edu> wrote:
> On Sat, Mar 21, 2009 at 6:11 PM, Barton Willis <willisb at unk.edu> wrote:
> ...lists, which as far as Maxima is concerned, are simply function applications
> where the function is "[", just as sums are function applications
> where the function is "+".
As a general rule, Maxima allows operations which take lists as
arguments (delete, append, reverse, map, cons, endcons, last, length,
rest, member) to take any functional application as an argument and
act on the arguments. The result in the single-argument case is
funmake( op(expr), FUNC( args(expr) ) )
and it generalizes to multiple list arguments as well, requiring that
the operators be the same, thus:
member( a, a+b+c ) => TRUE
cons( q, r . s ) => q . r . s
append ( q ^^ r , s ^^ t ) => <error> (^^ is not n-ary)
endcons ( 3, 'block( [], f(x) ) ) => block( [], f(x), 3 )
append ( a+b, c*d ) => <error> (not the same operator)
It seems to me perfectly natural that sublist should work the same way.
-s