Martin, I prefer to use the email lists - one list or the other is fine.
'rep' is equivalent to the function: rep(x:%):Rep == x pretend Rep similarly per(x:Rep):% == x pretend % These functions implement type-safe casts from a domain to it's underlying representation and back. In FriCAS these casts are (mostly) implicit. In Aldor these where made explicit. In OpenAxiom they are built-in. I use them all the time in my FriCAS coding. > zero? a == zero? rep a means that the 'zero?' function of this domain is the same as the 'zero?' function of it's representation. Regards, Bill Page. On Wed, Oct 12, 2011 at 4:19 AM, Martin Baker <[email protected]> wrote: > Bill, > > Do you know what rep (lower case) does in OpenAxiom and how I could implement > it in FriCAS? as in: > > zero? a == zero? rep a > > which comes from the code below. > > Martin > > PS: is it alright to ask you this directly or is it best to use the FriCAS or > OpenAxiom forums? > --------------------------------------- > )abbrev domain ARITY Arity > ++ Author: Gabriel Dos Reis > ++ Date Created: December 04, 2008 > ++ Date Last Updated: May 09, 2009 > ++ Description: > ++ This domain implements the arity of a function or an operator, > ++ e.g. the number of arguments that an operator can take. An > ++ arity is either a definition nonnegative integer, and the special > ++ value `arbitrary', signifying that an operation can take any > ++ number of arguments. > Arity(): Public == Private where > Public == Join(SetCategory, RetractableTo NonNegativeInteger) with > arbitrary: % > ++ aribitrary is the arity of a function that accepts any > ++ number of arguments. > zero?: % -> Boolean > ++ \spad{zero? a} holds if \spad{a} is the arity of niladic function. > one?: % -> Boolean > ++ \spad{one? a} holds if \spad{a} is the arity of nullary function. > Private == add > Rep == SingleInteger > arbitrary == per(-1) > zero? a == zero? rep a > one? a == one? rep a > hash x == hash rep x > x = y == rep x = rep y > coerce(x: %): OutputForm == > x = arbitrary => 'arbitrary::OutputForm > rep(x)::OutputForm > coerce(n: NonNegativeInteger): % == > max()$SingleInteger < n => > error "arity is too large for OpenAxiom" > per(n::SingleInteger) > retractIfCan x == > negative?(n := rep x) => "failed" > n@Integer::NonNegativeInteger > > @ > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/fricas-devel?hl=en.
