/usr/share/axiom-20170501/src/algebra/ROMAN.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | )abbrev domain ROMAN RomanNumeral
++ Author: Mark Botch
++ Description:
++ \spadtype{RomanNumeral} provides functions for converting
++ integers to roman numerals.
RomanNumeral() : SIG == CODE where
SIG ==> IntegerNumberSystem with
canonical
++ mathematical equality is data structure equality.
canonicalsClosed
++ two positives multiply to give positive.
noetherian
++ ascending chain condition on ideals.
convert : Symbol -> %
++ convert(n) creates a roman numeral for symbol n.
roman : Symbol -> %
++ roman(n) creates a roman numeral for symbol n.
roman : Integer -> %
++ roman(n) creates a roman numeral for n.
CODE ==> Integer add
import NumberFormats()
roman(n:Integer) == n::%
roman(sy:Symbol) == convert sy
convert(sy:Symbol):% == ScanRoman(string sy)::%
coerce(r:%):OutputForm ==
n := convert(r)@Integer
-- okay, we stretch it
zero? n => n::OutputForm
negative? n => - ((-r)::OutputForm)
FormatRoman(n::PositiveInteger)::Symbol::OutputForm
|