Hi Wolfgang,
you get a lot of help and examples from the documentation chapter 6.8 (Syntax), especially
from function infix.
looking at your examples I think it's the best way first to define the new operator and then
secondly defining the associated function:
(%i1) infix("@")$
(%i2) "@"(a, b) := sconcat("(", a, ",", b, ")")$
(%i3) 12 at 34;
(%o3) (12,34)
the binding powers you get with
(%i4) :lisp (get '$@ 'rbp)
180
(%i4) :lisp (get '$@ 'lbp)
180
here we have the default value 180
Volker van Nek
Am 22 Jun 2007 um 21:12 hat Wolfgang Lindner geschrieben:
> dear group,
>
> I want to define the logical 'implication' as an infix operator:
>
> (%i1) implication(p,q) := ((not (p)) or (q));
> (%i2) "==>"(p, q) := ((not (p)) or (q));
> (%i3) infix ("==>", 41, 41)$
> (%i4) true ==> false;
> (%o4) false
>
> Here are my questions:
> (Q1) I'm not sure if I have choosen an appropriate l/r binding power with the value 41.
> Are there any conflicts possible?
> (Q2) Is it possible to ask MAXIMA for the binding powers of an (pre)defined operator?
>
> (Bug?): the following example of the help file entry 'infix' does _not_ work for me,
> I get an error (wxMaxima 0.7.2, Maxima 5.12):
>
> (ko) "@"(a, b) := sconcat("(", a, ",", b, ")")$
> whereas using '~' instead of the at-sign works:
> (ok) "~"(a, b) := sconcat("(", a, ",", b, ")")$
>
> (Q3) is there a list of vorbidden/allowed signs for operators?
>
> HTH Wolfgang
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima