From: Robert D. <rob...@gm...> - 2025-08-10 22:41:09
|
On Fri, Aug 8, 2025 at 1:50 AM Oleg Nesterov <ol...@re...> wrote: > (%i1) '"+"(2,2) = 4; > (%o1) 2 + 2 = 4 Huh, I'm a little surprised (although not very much) that this has the expected effect ... I guess that's a %MPLUS expression instead of MPLUS, and the simplification rules for MPLUS aren't also implemented for %MPLUS. OK by me. > (%i2) '"."(matrix([1, 2], [3, 4]), matrix([1], [2])) = matrix([5],[11]); > ┌ ┐ ┌ ┐ ┌ ┐ > │ 1 2 │ │ 1 │ │ 5 │ > (%o2) (│ │) . (│ │) = │ │ > │ 3 4 │ │ 2 │ │ 11 │ Here the issue is that the operator is %MNCTIMES which does not have a right or left binding power (precedence) defined for it. Try this: :lisp (setf (get '%mnctimes 'rbp) (get 'mnctimes 'rbp)) :lisp (setf (get '%mnctimes 'lbp) (get 'mnctimes 'lbp)) which gives %MNCTIMES the same precedence, and therefore parentheses in the same places, as MNCTIMES. > (%i4) a = b . c; > (%o4) a = b . c > (%i5) '"="(a, b.c); > (%o5) a = (b . c) > (%i6) :lisp (defprop %mequal 80. lbp) > (%i6) :lisp (defprop %mequal 80. rbp) Likewise I guess we would say :lisp (setf (get '%mequal 'rbp) (get 'mequal 'rbp)) :lisp (setf (get '%mequal 'lbp) (get 'mequal 'lbp)) I don't see why the nounified operators should not have the same binding powers as the un-nounified -- I will try to remember to update grind.lisp. Robert |