#284 Operator "/" treated inconsistently

closed
Lisp Core (471)
5
2009-05-28
2003-03-31
No

"/"(a,b) correctly gives a/b

However, in most other contexts, Maxima expects "//":

part(a/b,0) => // WHY?
subst("/",f,f(a,b)) => /(a,b) NO!
substpart("/",f(a,b),0) => /(a,b) NO!
apply("/",[a,b]) => /(a,b) NO!

This is presumably a relic of the Maclisp quoting
convention that used slash to quote the next character
(similar to backslash in Common Lisp). Presumably in
the Maclisp version, it cancelled out and the user
saw "/", not "//". This needs to be fixed for Common
Lisp.

Maxima 5.9.0 GCL 2.5.0 Windows 2000

Discussion

  • Robert Dodier

    Robert Dodier - 2005-04-11
    • labels: --> Lisp Core
    • summary: Operator "/" treated inconsistently --> Operator "/" treated inconsistently
     
  • Robert Dodier

    Robert Dodier - 2005-04-11

    Logged In: YES
    user_id=501686

    This seems to be a problem with differing internal and
    external representations for the same operator. I don't
    think the / vs // has much to do with it, although it would
    be nice if one or the other were used consistently.

    An input a/b is parsed as ((MQUOTIENT) $A $B) -- as far as I
    can tell, it is not simplified to that from ((&/) $A $B),
    instead it seems the simplifier never sees the operator (&/)
    and so it doesn't have any rules for simplifying that into
    (MQUOTIENT).

    It seems the fundamental problem would be resolved by moving
    the substitution / --> MQUOTIENT out of the parser and into
    the simplifier; if there are other such replacements, maybe
    they should be moved too.

    tellsimpafter seems happy enough to clean up for us:

    (%i9) apply("/", [a,b]);
    (%o9) /(a, b) /* OOPS */
    [... snip ...]
    (%i11) matchdeclare ([a,b],true);
    (%o11) done
    (%i12) tellsimpafter (''%o9, a/b);
    (%o12) [/RULE1, false]
    [... snip ...]
    (%i19) apply ("/", [a+b, c-d]);
    b + a
    (%o19) ----- /* OK */
    c - d
    (%i20) subst ("/", f, f(x,y));
    x
    (%o20) - /* OK */
    y
    (%i21) substpart ("/", f(x,y), 0);
    x
    (%o21) - /* OK */
    y

     
  • Robert Dodier

    Robert Dodier - 2006-07-10

    Logged In: YES
    user_id=501686

    Closely related to bug report # 792114. Maybe applying fix
    given in that report will fix the problems shown here.

     
  • Robert Dodier

    Robert Dodier - 2006-07-10
    • assigned_to: nobody --> robert_dodier
     
  • Dieter Kaiser

    Dieter Kaiser - 2009-05-28
    • status: open --> closed
     
  • Dieter Kaiser

    Dieter Kaiser - 2009-05-28

    With revision 1.27 of comm.lisp the name of the operator / has changed to "/".

    The examples of this bug report give as expected:

    (%i8) part(a/b);
    (%o8) a/b
    (%i9) part(a/b,0);
    (%o9) "/"
    (%i10) subst("/",f,f(a,b));
    (%o10) a/b
    (%i11) substpart("/",f(a,b),0);
    (%o11) a/b
    (%i12) apply("/",[a,b]);
    (%o12) a/b

    Closing this bug report as fixed.

    Dieter Kaiser

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks