#1355 ev doesn't work as expected with subscripted variables

open
nobody
Lisp Core (471)
5
2012-12-04
2008-02-21
David Ronis
No

f(l,m):=A[l,m]+B[l,m]+A[l+1,m];
ev(f(l,m), A[l,m]=0);

A[l,m] still appears in the result.

However,

f(l,m);
ev(%, A[l,m]=0 );

works as expected.

Discussion

  • Stavros Macrakis

    Logged In: YES
    user_id=588346
    Originator: NO

    Thanks for the bug report. EV is a very funny function, and often produces peculiar surprises like this.

    I hope we'll be able to fix this at some point, but in the meantime, I'd suggest you use subst to evaluate things like this:

    subst([a[l,m]=0],f(l,m))

    instead of ev.

     
  • Robert Dodier

    Robert Dodier - 2008-06-21

    Logged In: YES
    user_id=501686
    Originator: NO

    For the record, my comments on this problem 2008-02-21:

    Well, the mechanism for saving and restoring local variables handles only simple variables (not
    subscripted variables). ev substitutes for subscripted variables instead. But substitution doesn't have quite the same effect, as you have observed. See $EV in src/mlisp.lisp.

    This is a bug; I guess it could be fixed by making MBIND and friends happy with subscripted variables. Dunno if that would cause trouble elsewhere.

     
  • Robert Dodier

    Robert Dodier - 2008-06-21
    • labels: 870406 --> Lisp Core
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks