The new Decimal API

This commit is contained in:
Krasimir Angelov
2023-08-21 20:14:26 +02:00
parent 58da8deca8
commit fb398c603e
147 changed files with 918 additions and 188 deletions

View File

@@ -79,6 +79,7 @@ concrete CatHun of Cat = CommonX - [Adv] ** open ResHun, Prelude in {
Card = ResHun.Numeral ;
Numeral = ResHun.Numeral ;
Digits = {s : CardOrd => Str} ;
Decimal = {s : CardOrd => Str; hasDot : Bool} ;

View File

@@ -137,6 +137,10 @@ concrete NounHun of Noun = CatHun ** open
s = \\place => dig.s ! NCard ;
} ;
NumDecimal dec = dec ** {
s = \\place => dec.s ! NCard ;
} ;
-- : Numeral -> Card ;
NumNumeral num = num ;

View File

@@ -1,4 +1,4 @@
concrete NumeralHun of Numeral = CatHun [Numeral,Digits] **
concrete NumeralHun of Numeral = CatHun [Numeral,Digits,Decimal] **
open Prelude, ResHun in {
lincat
@@ -115,6 +115,13 @@ oper
D_8 = mkDig "8" ;
D_9 = mkDig "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecinal d = {
s = \\x => "-" ++ BIND ++ d.s ! x ;
n = numNumber ;
hasDot=False
} ;
oper
mkDig : Str -> TDigit = \s -> {
s = s ;