On Mon, Dec 14, 2009 at 1:38 PM, Ralf Hemmecke wrote: > > Suppose I define a binary operator > > =: (%, %) -> % > > (which I could do in SPAD). I just use "=" as a fancy name for a binary > infix operator (has nothing to do with equality). > > If I then write something like > > a=b*c=d > > what would you guess what the precedence is? Where would you look up? > (Try to do this without starting fricas.) > > The following seems to show a bug in fricas? > > Waldek, I really tried to write a new domain with = of the above type. > > ---rhxBEGIN newop.spad > )abbrev domain MYINT MyInt > MyInt(): Join(IntegerNumberSystem, ConvertibleTo String, OpenMath,_ > Canonical, canonicalsClosed) with > _=: (%, %) -> % > == Integer add > ((x:%) = (y:%)):% == x - y > ---rhxEND newop.spad > > seems to compile fine. > > But how can I call this function in infix form? >
Ralf, The interpreter internally translates 'x=y' to 'equation(x,y)' so try this: Try this: ---rhxBEGIN newop.spad )abbrev domain MYINT MyInt MyInt(): Join(IntegerNumberSystem, ConvertibleTo String, OpenMath,_ Canonical, canonicalsClosed) with equation: (%, %) -> % == Integer add equation((x:%) , (y:%)):% == x - y ---rhxEND newop.spad (1) -> )co newop Compiling FriCAS source code from file /home/wspage/newop.spad using old system compiler. MYINT abbreviates domain MyInt ------------------------------------------------------------------------ initializing NRLIB MYINT for MyInt compiling into NRLIB MYINT compiling exported equation : ($,$) -> $ ;;; *** |MYINT;equation;3$;1| REDEFINED Time: 0 SEC. (time taken in buildFunctor: 4) ;;; *** |MyInt| REDEFINED ;;; *** |MyInt| REDEFINED Time: 0.004 SEC. Cumulative Statistics for Constructor MyInt Time: 0.004 seconds (|RealConstant|) extends (|ConvertibleTo| (|DoubleFloat|)) but not (|ConvertibleTo| (|String|)) finalizing NRLIB MYINT Processing MyInt for Browser database: --->/home/wspage/newop.spad-->MyInt((equation (% % %))): Not documented!!!! --->/home/wspage/newop.spad-->MyInt(constructor): Not documented!!!! --->/home/wspage/newop.spad-->MyInt(): Missing Description ; compiling file "/home/wspage/MYINT.NRLIB/MYINT.lsp" (written 14 DEC 2009 07:36:24 PM): ; file: /home/wspage/MYINT.NRLIB/MYINT.lsp ; in: DEFUN |MyInt;| ; (BOOT::|haddProp| BOOT::|$ConstructorCache| 'BOOT::|MyInt| NIL ; (CONS 1 BOOT::$)) ; ; caught WARNING: ; undefined variable: |$ConstructorCache| ; in: DEFUN |MyInt| ; (VMLISP:HGET BOOT::|$ConstructorCache| 'BOOT::|MyInt|) ; --> GETHASH ; ==> ; (SB-IMPL::GETHASH3 'BOOT::|MyInt| BOOT::|$ConstructorCache| NIL) ; ; caught WARNING: ; undefined variable: |$ConstructorCache| ; ; compilation unit finished ; Undefined variable: ; |$ConstructorCache| ; caught 2 WARNING conditions ; /home/wspage/MYINT.NRLIB/MYINT.fasl written ; compilation finished in 0:00:00.008 ------------------------------------------------------------------------ MyInt is already explicitly exposed in frame frame1 MyInt will be automatically loaded when needed from /home/wspage/MYINT.NRLIB/MYINT (1) -> (2=1)@MyInt (1) 1 Type: MyInt (2) -> -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To post to this group, send email to fricas-de...@googlegroups.com. To unsubscribe from this group, send email to fricas-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/fricas-devel?hl=en.