|
From: Barton W. <wi...@un...> - 2026-01-24 21:34:49
|
I think that you want to use the function remarray; example (%i3) (a[1] : 1,a[2] : 2, a[3] : p+q); (%o3) q+p (%i4) arrayinfo(a); (%o4) [hashed,1,[1],[2],[3]] (%i5) remarray(a); (%o5) [a] (%i6) arrayinfo(a); arrayinfo: a is not an array. To keep a hasharray from being global, use 'local': (%i1) functiong():=block([b], local(b), b[6]:5,return())$ (%i2) functiong(); (%o2) false (%i3) arrayinfo(b); arrayinfo: b is not an array. Finally, million element hasharrays are not impossible: (%i1) reallybig() := block([a], local(a), for k : 1 thru 10^6 do ( a[k] : 1/k), a[42]); (%o1) reallybig():=block([a],local(a),for k thru 10^6 do a[k]:1/k,a[42]) (%i2) reallybig(); (%o2) 1/42 (%i3) time(%); (%o3) [7.890625] As for restrictions on hasharrays, as far as I know, keys and values can be any Maxima expression (%i9) a[5<9] : matrix([1,2],[3,4]); (%o9) matrix([1,2],[3,4]) (%i10) a[5<9]; (%o10) matrix([1,2],[3,4]) Thank you for your interest in Maxima; if you have more questions, please send a note to the mailing list. --Barton ________________________________ From: Martin Marmsoler <mar...@gm...> Sent: Saturday, January 24, 2026 1:11 PM To: Maxima discuss <max...@li...> Subject: [Maxima-discuss] Deleting hash arrays Caution: Non-NU Email Currently I am trying to delete a hash, so that it is anymore available, but without success. When having a variable between the square brackets of the block, it is only local available f() := block([a], a: 5, return()); Doing the same thing with hash arrays, the hash is still accessible from the outside (%i2) functionf() := block([a], a[6]: 5, return() ); kill(a); (%o1) functionf():=block([a],a[6]:5,return()) (%o2) done (%i3) functionf(); (%o3) false (%i4) arrayinfo(a); (%o4) [hashed,1,[6]] What is the proper way to delete hash arrays? Best regards, Martin |