display of "lisp arrays" from make_array



On 4/28/2012 9:12 AM, Raymond Toy wrote:
> On 4/28/12 8:01 AM, Richard Fateman wrote:
>> On 4/27/2012 12:33 PM, Raymond Toy wrote:
>>>
>>>
>>> On Fri, Apr 27, 2012 at 11:22 AM, Richard Fateman 
>>> <fateman at eecs.berkeley.edu <mailto:fateman at eecs.berkeley.edu>> wrote:
>>>
>>>     I wonder if there is a reason to use lisp display rather than
>>>     maxima display to show the results of make_array.
>>>
>>>     foo:make_array(any,5);
>>>     foo[0]:2*x;
>>>     foo;
>>>
>>>     foo displays as
>>>              {Lisp Array: #(((MTIMES SIMP) 2 $X) NIL)}
>>>
>>>
>>> Shouldn't they be displayed in some unique way so you can tell the 
>>> difference between a list and an array?
>>>
>>> Ray
>>>
>> I'd be happy with something like LispArray{0..4}[2*x, 
>> false,false,....], for example.
>> We need to specify where the element with index 0 is.
>> More generally I think that we could  
>> LispArray{type}{lo1..hi1}{lo2..hi2}...
>>
> Wouldn't this be a rather odd presentation?  All (almost all?) of 
> maxima's output can be pretty much cut-and-pasted and reused as input 
> (not including 2D output).
Yes, the current output .... { Lisp Array ....}  cannot be 
cut-and-pasted either!

  Perhaps a 'constructor' form can be arranged though.

>   Would we have to be able to read that back in?
no but ...
>
> Why is the lower limit required in the output?  Lisp arrays always 
> start with index 0.



or  using facilities already in Maxima, we could display this Lisp Array 
as ...

fillarray(make_array(any,4),[2*x,false,false,false])

and this could be cut-and-pasted.

Or we could have a slightly nice format that was equivalent to the one 
above, e.g.

LispArray([any,4], [2*x,false,false,false])

I'm assuming that extensions for more dimensions could be tacked on by 
listing stuff
in row-major order or whatever.


RJF