spad
)abbrev domain NZINT NonZeroInteger
NonZeroInteger: Join(OrderedAbelianSemiGroup, Monoid, CommutativeStar,CoercibleTo(Integer)) with
gcd: (%,%) -> %
++ gcd(a,b) computes the greatest common divisor of two
++ positive integers \spad{a} and b.
_-: % -> %
retract:Integer->%
retractIfCan:Integer->Union(%,"failed")
retract:NonNegativeInteger->%
retractIfCan:NonNegativeInteger->Union(%,"failed")
convert:NonNegativeInteger->%
== SubDomain(Integer,#1 ~= 0) add
Rep == Integer
x:%
y:%
z:Integer
nz:NonNegativeInteger
-x == (-(x pretend Integer)) pretend %
x+y ==
(z:=(x pretend Integer)+(y pretend Integer)) = 0 => error "zero"
z pretend %
coerce(x):Integer == x pretend Integer
retract(z)== z pretend %
convert(nz):% == retract(nz)
retractIfCan(z) ==
zero?(z) => "failed"
retract(z)
retract(nz)== nz pretend %
retractIfCan(nz) ==
zero?(nz) => "failed"
retract(nz)
spad
Compiling FriCAS source code from file
/var/zope2/var/LatexWiki/1280517217541771186-25px001.spad using
old system compiler.
NZINT abbreviates domain NonZeroInteger
------------------------------------------------------------------------
initializing NRLIB NZINT for NonZeroInteger
compiling into NRLIB NZINT
compiling exported - : $ -> $
NZINT;-;2$;1 is replaced by -
Time: 0.06 SEC.
compiling exported + : ($,$) -> $
Time: 0 SEC.
compiling exported coerce : $ -> Integer
NZINT;coerce;$I;3 is replaced by x
Time: 0 SEC.
compiling exported retract : Integer -> $
NZINT;retract;I$;4 is replaced by z
Time: 0 SEC.
compiling exported convert : NonNegativeInteger -> $
Time: 0 SEC.
compiling exported retractIfCan : Integer -> Union($,failed)
Time: 0.01 SEC.
compiling exported retract : NonNegativeInteger -> $
NZINT;retract;Nni$;7 is replaced by nz
Time: 0 SEC.
compiling exported retractIfCan : NonNegativeInteger -> Union($,failed)
Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |NonZeroInteger| REDEFINED
;;; *** |NonZeroInteger| REDEFINED
Time: 0 SEC.
Cumulative Statistics for Constructor NonZeroInteger
Time: 0.07 seconds
--------------non extending category----------------------
.. NonZeroInteger of cat
(|Join| (|OrderedAbelianSemiGroup|) (|Monoid|) (|CommutativeStar|)
(|CoercibleTo| (|Integer|))
(CATEGORY |domain| (SIGNATURE |gcd| ($ $ $))
(SIGNATURE - ($ $)) (SIGNATURE |retract| ($ (|Integer|)))
(SIGNATURE |retractIfCan|
((|Union| $ "failed") (|Integer|)))
(SIGNATURE |retract| ($ (|NonNegativeInteger|)))
(SIGNATURE |retractIfCan|
((|Union| $ "failed") (|NonNegativeInteger|)))
(SIGNATURE |convert| ($ (|NonNegativeInteger|))))) has no
(|IntegerNumberSystem|) finalizing NRLIB NZINT
Processing NonZeroInteger for Browser database:
--------(gcd (% % %))---------
--->-->NonZeroInteger((- (% %))): Not documented!!!!
--->-->NonZeroInteger((retract (% (Integer)))): Not documented!!!!
--->-->NonZeroInteger((retractIfCan ((Union % failed) (Integer)))): Not documented!!!!
--->-->NonZeroInteger((retract (% (NonNegativeInteger)))): Not documented!!!!
--->-->NonZeroInteger((retractIfCan ((Union % failed) (NonNegativeInteger)))): Not documented!!!!
--->-->NonZeroInteger((convert (% (NonNegativeInteger)))): Not documented!!!!
--->-->NonZeroInteger(constructor): Not documented!!!!
--->-->NonZeroInteger(): Missing Description
; (DEFUN |NonZeroInteger| ...) is being compiled.
;; The variable |$ConstructorCache| is undefined.
;; The compiler will assume this variable is a global.
------------------------------------------------------------------------
NonZeroInteger is now explicitly exposed in frame initial
NonZeroInteger will be automatically loaded when needed from
/var/zope2/var/LatexWiki/NZINT.NRLIB/NZINT
axiom
)show NZINT
NonZeroInteger is a domain constructor
Abbreviation for NonZeroInteger is NZINT
This constructor is exposed in this frame.
------------------------------- Operations --------------------------------
?*? : (%,%) -> % ?*? : (PositiveInteger,%) -> %
?**? : (%,PositiveInteger) -> % ?+? : (%,%) -> %
-? : % -> % ?<? : (%,%) -> Boolean
?<=? : (%,%) -> Boolean ?=? : (%,%) -> Boolean
?>? : (%,%) -> Boolean ?>=? : (%,%) -> Boolean
1 : () -> % ?^? : (%,PositiveInteger) -> %
coerce : % -> Integer coerce : % -> OutputForm
convert : NonNegativeInteger -> % gcd : (%,%) -> %
hash : % -> SingleInteger latex : % -> String
max : (%,%) -> % min : (%,%) -> %
one? : % -> Boolean recip : % -> Union(%,"failed")
retract : NonNegativeInteger -> % retract : Integer -> %
sample : () -> % ?~=? : (%,%) -> Boolean
?**? : (%,NonNegativeInteger) -> %
?^? : (%,NonNegativeInteger) -> %
retractIfCan : NonNegativeInteger -> Union(%,"failed")
retractIfCan : Integer -> Union(%,"failed")
axiom
i:NZINT:=1
axiom
j:NZINT:=-1
Cannot convert right-hand side of assignment
- 1
to an object of the type NonZeroInteger of the left-hand side.
j:NZINT:=-i
axiom
i+1
axiom
j+1
Type: NonNegativeInteger
?
axiom
i+j
>> Error detected within library code:
zero
axiom
i-j
There are 8 exposed and 3 unexposed library operations named -
having 2 argument(s) but none was determined to be applicable.
Use HyperDoc Browse, or issue
)display op -
to learn more about the available operations. Perhaps
package-calling the operation or using coercions on the arguments
will allow you to apply the operation.
Cannot find a definition or applicable library operation named -
with argument type(s)
NonZeroInteger
NonZeroInteger
Perhaps you should use "@" to indicate the required return type,
or "$" to specify which version of the function you need.
retractIfCan(0)$NZINT
Type: Union("failed",...)