forked from GitHub/gf-rgl
The new Decimal API
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
concrete NumeralCat of Numeral = CatCat [Numeral,Digits] **
|
||||
concrete NumeralCat of Numeral = CatCat [Numeral,Digits,Decimal] **
|
||||
open CommonRomance, ResRomance, MorphoCat, Prelude in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
@@ -158,6 +158,20 @@ param
|
||||
D_8 = mkDig "8" ;
|
||||
D_9 = mkDig "9" ;
|
||||
|
||||
PosDecimal d = d ** {hasDot=False} ;
|
||||
NegDecimal d = {
|
||||
s = \\o => "-" ++ BIND ++ d.s ! o ;
|
||||
n = Pl ;
|
||||
hasDot=False
|
||||
} ;
|
||||
IFrac d i = {
|
||||
s = \\o => d.s ! NCard Masc ++
|
||||
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
|
||||
i.s ! o ;
|
||||
n = Pl ;
|
||||
hasDot=True
|
||||
} ;
|
||||
|
||||
oper
|
||||
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
|
||||
mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":o") ;
|
||||
|
||||
Reference in New Issue
Block a user