From: Arthur Norman <acn1@ca...>  20110712 17:13:59

On Tue, 12 Jul 2011, Ted Kosan wrote: > Is it possible to multiply all of the members in a list by a value in > a manner which is similar to this example from MathPiper?: > > In> 3 * {a,b,c} > Result: {3*a,3*b,3*c} > > 1: a := {x,y,z}; a := {x,y,z} 2: for each p in a collect 3*p; {3*x,3*y,3*z} 3: One could imagine trying to find where the "Illegal operatio on lists" is produced and turn V op {A,B,C} into {V op A, V op B, V op C} and similarly if the list and item were the other way around. With care so that {a,b}*{c,d} gave {{a,b)*c, {a,b}*d} and hence {{a*c, b*c}, {a*d, b*d}} if that would be the right way round... > > Also, is there a predicate function like NUMBERP that determines if an > expression is a list and that can be used in algebraic mode? The > IsList function is used in MathPiper for this and here is an example > of it being used for reference: > > In> IsList(a) > Result: False > > In> IsList(4) > Result: False > > In> IsList(2*a) > Result: False > > In> IsList({a,b,c}) > Result: True > Looking at packages/rlisp/list.red to see how "first" etc are implemeted for lists providing a listp function should be easy... Also that file would be where one hacked in support for other operations over lists... I might feel the need to think for a bit about whether anything could be broken by installing those things but they may be safe... you can look at list.red and see what you thing! Arthur 