KASH3 Ref - operations

TU-Berlin | → | Inst. f. Mathematik | → | Algebra und Zahlentheorie | → | KASH | → | Documentation | → | Reference Manual
| KASH3 Reference Manual
Introduction | Reference Manual | Index
| search
| ### Keyword operations ### Description A record may contain a special 'operations' component which in turn is a record that contains functions. These functions are called when this record is an operand of '+', '-', '*', '/', '^', 'mod', 'in', 'Print', '=', '<'. In the 'operations' the names of the components of '+', '-', '*', '/', '^', '=', '<' have to be quoted, i.e., written as '\+', '\-' and so on. The unary '-a' is computed as '0-a','a <= b' is 'a < b or a = b', 'a > b' is 'not a < b', etc. ### Examples o := rec(); o.\+:= function(a,b) return rec(n :=2*a.n+b.n, operations := o); end; r := rec(n:=3, operations:=o); s:= rec(n:=4, operations := o); r+s; s+r; ### See also Extend ( any ) -> record Base ( any ) -> any record rec ( nof(any) ) -> record
| Built: Mon Nov 14 21:12:39 UTC 2005 on mack