mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-25 11:06:28 -06:00
The new Decimal API
This commit is contained in:
@@ -126,6 +126,7 @@ concrete CatIce of Cat = CommonX ** open ResIce, Prelude in {
|
||||
|
||||
Numeral = {s : CardOrd => Str ; n : Number} ;
|
||||
Digits = {s : CardOrd => Str ; n : Number} ;
|
||||
Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ;
|
||||
|
||||
|
||||
--2 Structural words
|
||||
|
||||
@@ -86,6 +86,10 @@ concrete NounIce of Noun = CatIce ** open MorphoIce, ResIce, Prelude in {
|
||||
s = \\g,c => d.s ! NCard d.n g c;
|
||||
n = d.n
|
||||
} ;
|
||||
NumDecimal d = {
|
||||
s = \\g,c => d.s ! NCard d.n g c;
|
||||
n = d.n
|
||||
} ;
|
||||
|
||||
NumNumeral d = {
|
||||
s = \\g,c => d.s ! NCard Sg g c;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete NumeralIce of Numeral = CatIce [Numeral,Digits] ** open Prelude, ResIce in {
|
||||
concrete NumeralIce of Numeral = CatIce [Numeral,Digits,Decimal] ** open Prelude, ResIce in {
|
||||
|
||||
param
|
||||
DForm = unit | teen | ten ;
|
||||
@@ -203,6 +203,20 @@ concrete NumeralIce of Numeral = CatIce [Numeral,Digits] ** open Prelude, ResIce
|
||||
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 Sg Masc Nom ++
|
||||
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
|
||||
i.s ! o ;
|
||||
n = Pl ;
|
||||
hasDot=True
|
||||
} ;
|
||||
|
||||
oper
|
||||
|
||||
mkDig : Str -> TDigit = \c -> mk2Dig c (c + ".") ;
|
||||
|
||||
Reference in New Issue
Block a user