saving/loading a hashed array from/to file



On 03/10/2012 02:10 PM, Richard Fateman wrote:
> did you try the save command?
Ah!

save("./Fdata.lisp",F);
load("./Fdata.lisp");

works.

I read the documentation of save and load,
but due to the missing variable of load
I thought you can't get the data back to F
but now I see that the name F is stored in the lisp file too.

But my reduced question remains.
If I have two lists

ai : [hashed,1,[1],[2],[3],[4],[[1,1]],[[2,2]],[[3,3]],[[4,4]]];
la : [11,22,33,44,[11,11],[22,22],[33,33],[44,44]];

is it possible to attach them to F?

Kind regards,
Andre

>
> On 3/10/12 4:37 AM, andre maute wrote:
>> On 03/10/2012 02:13 AM, andre maute wrote:
>>> Hi list,
>>>
>>> as the subject says, suppose we have the following maxima file
>>> with a very simple hashed array function F
>>>
>>> ------------- hashed.max ------------
>>> display2d : false;
>>>
>>> F[k] := block(print(" F",k),return(k*11));
>>>
>>> for k : 1 thru 4 do block(
>>> h : F[k],
>>> print(k,h)
>>> );
>>> print("----");
>>> for k : 1 thru 4 do block(
>>> h : F[k],
>>> print(k,h)
>>> );
>>>
>>> for k : 1 thru 4 do block(
>>> h : F[[k,k]],
>>> print(k,h)
>>> );
>>> print("----");
>>> for k : 1 thru 4 do block(
>>> h : F[[k,k]],
>>> print(k,h)
>>> );
>>>
>>> print(F);
>>> print(arrayinfo(F));
>>> print(listarray(F));
>>> ------------- hashed.max ------------
>>>
>>> Question:
>>>
>>> arrayinfo and listarray give the computed values,
>>> Is it possible to save this data to a file and
>>> and load it again for a later computation?
>>>
>>> Any hint where I should look in the documentation?
>>
>> Reduced question:
>>
>> if I already know, that F should look like
>>
>> (%i10) arrayinfo(F)
>> (%o10) [hashed,1,[1],[2],[3],[4],[[1,1]],[[2,2]],[[3,3]],[[4,4]]]
>> (%i11) listarray(F)
>> (%o11) [11,22,33,44,[11,11],[22,22],[33,33],[44,44]]
>>
>> but don't want to recalculate using F,
>> how can I attach this data to F?
>>
>> Best regards
>> Andre
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima at math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>