#2124 function definition doesn't update

Lisp Core (471)

In two consecutive cells enter:
h[i,j]:= i+j;

Evaluate both cells. Then make any change to h[i,j] and reevaluate. The new definition is not used. See attached.

Maxima version: 5.22.1
Maxima build date: 11:48 8/13/2010
Host type: i686-pc-mingw32
Lisp implementation type: GNU Common Lisp (GCL)
Lisp implementation version: GCL 2.6.8


  • Van

    Van - 2011-01-07

    function doesn't update demonstration

  • Van

    Van - 2011-01-07
    • priority: 5 --> 9
  • Barton Willis

    Barton Willis - 2011-01-07

    This isn't a bug. The statement h[i,j]:= i+j defines a memoizing function. To redefine a memoizing function, first use remarray; example:

    (%i1) a[i] := 5;
    (%o1) a[i]:=5
    (%i2) a[7];
    (%o2) 5
    (%i3) a[i] := 8;
    (%o3) a[i]:=8
    (%i4) a[7];
    (%o4) 5
    (%i5) a[42];
    (%o5) 8
    (%i6) remarray(a);
    (%o6) [a]
    (%i7) a[i] := 8;
    (%o7) a[i]:=8
    (%i8) a[7];
    (%o8) 8

    I'd guess that the user documentation isn't all that clear about this.

  • Van

    Van - 2011-01-07
    • priority: 9 --> 1
  • Van

    Van - 2011-01-07

    In the documentation under genmatrix, it might be useful to say:
    Since h[i,j] is memoizing, redefinitions will not "stick" until a call to remarray(h) is made. Consider the following example: (see 4 line example appended to this 'bug').

    or some such

  • Dieter Kaiser

    Dieter Kaiser - 2011-02-17

    As written in this thread this is not a bug.
    Closing this bug as invalid.
    Dieter Kaiser

  • Dieter Kaiser

    Dieter Kaiser - 2011-02-17
    • status: open --> closed

Log in to post a comment.