diff options
Diffstat (limited to 'stdlib/source/lux.lux')
-rw-r--r-- | stdlib/source/lux.lux | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 7a49fb2ec..d29e4fca5 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -25,9 +25,9 @@ (+1 [["lux" "doc"] (+5 "Your standard, run-of-the-mill integer numbers.")] (+0))))) -(_lux_def Real - (+12 ["lux" "Real"] - (+0 "#Real" (+0))) +(_lux_def Frac + (+12 ["lux" "Frac"] + (+0 "#Frac" (+0))) (+1 [["lux" "type?"] (+0 true)] (+1 [["lux" "export?"] (+0 true)] (+1 [["lux" "doc"] (+5 "Your standard, run-of-the-mill floating-point numbers.")] @@ -212,7 +212,7 @@ ## (#NatA Nat) ## (#IntA Int) ## (#DegA Deg) -## (#RealA Real) +## (#FracA Frac) ## (#TextA Text) ## (#IdentA Ident) ## (#ListA (List Ann-Value)) @@ -231,8 +231,8 @@ Int (#Sum ## #DegA Deg - (#Sum ## #RealA - Real + (#Sum ## #FracA + Frac (#Sum ## #TextA Text (#Sum ## #IdentA @@ -249,7 +249,7 @@ (#Cons (+5 "NatA") (#Cons (+5 "IntA") (#Cons (+5 "DegA") - (#Cons (+5 "RealA") + (#Cons (+5 "FracA") (#Cons (+5 "TextA") (#Cons (+5 "IdentA") (#Cons (+5 "ListA") @@ -380,7 +380,7 @@ ## (#Nat Nat) ## (#Int Int) ## (#Deg Deg) -## (#Real Real) +## (#Frac Frac) ## (#Text Text) ## (#Symbol Text Text) ## (#Tag Text Text) @@ -404,8 +404,8 @@ Int (#Sum ## "lux;Deg" Deg - (#Sum ## "lux;Real" - Real + (#Sum ## "lux;Frac" + Frac (#Sum ## "lux;Text" Text (#Sum ## "lux;Symbol" @@ -424,7 +424,7 @@ (#Cons (#TextA "Nat") (#Cons (#TextA "Int") (#Cons (#TextA "Deg") - (#Cons (#TextA "Real") + (#Cons (#TextA "Frac") (#Cons (#TextA "Text") (#Cons (#TextA "Symbol") (#Cons (#TextA "Tag") @@ -732,9 +732,9 @@ (_lux_function _ value (_meta (#Deg value)))) #Nil) -(_lux_def real$ - (_lux_: (#Function Real Code) - (_lux_function _ value (_meta (#Real value)))) +(_lux_def frac$ + (_lux_: (#Function Frac Code) + (_lux_function _ value (_meta (#Frac value)))) #Nil) (_lux_def text$ @@ -1778,8 +1778,8 @@ [_ [_ (#Deg value)]] (return (wrap-meta (form$ (list (tag$ ["lux" "Deg"]) (deg$ value))))) - [_ [_ (#Real value)]] - (return (wrap-meta (form$ (list (tag$ ["lux" "Real"]) (real$ value))))) + [_ [_ (#Frac value)]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Frac"]) (frac$ value))))) [_ [_ (#Text value)]] (return (wrap-meta (form$ (list (tag$ ["lux" "Text"]) (text$ value))))) @@ -2121,16 +2121,16 @@ (_lux_proc [<category> "="] [subject test])))] [ Nat "nat" n.= n.< n.<= n.> n.>= - "Natural equality." "Natural less-than." "Natural less-than-equal." "Natural greater-than." "Natural greater-than-equal."] + "Nat(ural) equality." "Nat(ural) less-than." "Nat(ural) less-than-equal." "Nat(ural) greater-than." "Nat(ural) greater-than-equal."] [ Int "int" i.= i.< i.<= i.> i.>= - "Integer equality." "Integer less-than." "Integer less-than-equal." "Integer greater-than." "Integer greater-than-equal."] + "Int(eger) equality." "Int(eger) less-than." "Int(eger) less-than-equal." "Int(eger) greater-than." "Int(eger) greater-than-equal."] [ Deg "deg" d.= d.< d.<= d.> d.>= - "Degree equality." "Degree less-than." "Degree less-than-equal." "Degree greater-than." "Degree greater-than-equal."] + "Deg(ree) equality." "Deg(ree) less-than." "Deg(ree) less-than-equal." "Deg(ree) greater-than." "Deg(ree) greater-than-equal."] - [Real "real" r.= r.< r.<= r.> r.>= - "Real equality." "Real less-than." "Real less-than-equal." "Real greater-than." "Real greater-than-equal."] + [Frac "frac" f.= f.< f.<= f.> f.>= + "Frac(tion) equality." "Frac(tion) less-than." "Frac(tion) less-than-equal." "Frac(tion) greater-than." "Frac(tion) greater-than-equal."] ) (do-template [<type> <name> <op> <doc>] @@ -2157,11 +2157,11 @@ [ Deg d./ [ "deg" "/"] "Deg(ree) division."] [ Deg d.% [ "deg" "%"] "Deg(ree) remainder."] - [Real r.+ ["real" "+"] "Real addition."] - [Real r.- ["real" "-"] "Real substraction."] - [Real r.* ["real" "*"] "Real multiplication."] - [Real r./ ["real" "/"] "Real division."] - [Real r.% ["real" "%"] "Real remainder."] + [Frac f.+ ["frac" "+"] "Frac(tion) addition."] + [Frac f.- ["frac" "-"] "Frac(tion) substraction."] + [Frac f.* ["frac" "*"] "Frac(tion) multiplication."] + [Frac f./ ["frac" "/"] "Frac(tion) division."] + [Frac f.% ["frac" "%"] "Frac(tion) remainder."] ) (do-template [<type> <name> <op> <doc>] @@ -2191,8 +2191,8 @@ [d.min Deg d.< "Deg(ree) minimum."] [d.max Deg d.> "Deg(ree) maximum."] - [r.min Real r.< "Real minimum."] - [r.max Real r.> "Real minimum."] + [f.min Frac f.< "Frac minimum."] + [f.max Frac f.> "Frac minimum."] ) (def:''' (Bool/encode x) @@ -2252,10 +2252,10 @@ (|> value (i./ 10) Int/abs) (|> value (i.% 10) Int/abs (_lux_:! Nat) digit-to-text))))) -(def:''' (Real/encode x) +(def:''' (Frac/encode x) #Nil - (-> Real Text) - (_lux_proc ["real" "encode"] [x])) + (-> Frac Text) + (_lux_proc ["frac" "encode"] [x])) (def:''' (multiple? div n) #Nil @@ -2686,8 +2686,8 @@ [_ (#Deg value)] (_lux_proc ["io" "error"] ["Undefined behavior."]) - [_ (#Real value)] - (Real/encode value) + [_ (#Frac value)] + (Frac/encode value) [_ (#Text value)] ($_ Text/append "\"" value "\"") @@ -2916,8 +2916,8 @@ [_ (#Deg value)] (return (form$ (list (tag$ ["lux" "DegA"]) (deg$ value)))) - [_ (#Real value)] - (return (form$ (list (tag$ ["lux" "RealA"]) (real$ value)))) + [_ (#Frac value)] + (return (form$ (list (tag$ ["lux" "FracA"]) (frac$ value)))) [_ (#Text value)] (return (form$ (list (tag$ ["lux" "TextA"]) (text$ value)))) @@ -4877,8 +4877,8 @@ (-> <from> <to>) (_lux_proc <proc> [n]))] - [real-to-int Real Int ["real" "to-int"]] - [int-to-real Int Real ["int" "to-real"]] + [frac-to-int Frac Int ["frac" "to-int"]] + [int-to-frac Int Frac ["int" "to-frac"]] ) (def: (find-baseline-column ast) @@ -4891,7 +4891,7 @@ [#Nat] [#Int] [#Deg] - [#Real] + [#Frac] [#Text] [#Symbol] [#Tag]) @@ -4958,8 +4958,8 @@ [int-to-nat ["int" "to-nat"] Int Nat] [nat-to-int ["nat" "to-int"] Nat Int] - [real-to-deg ["real" "to-deg"] Real Deg] - [deg-to-real ["deg" "to-real"] Deg Real] + [frac-to-deg ["frac" "to-deg"] Frac Deg] + [deg-to-frac ["deg" "to-frac"] Deg Frac] ) (def: (repeat n x) @@ -5008,7 +5008,7 @@ ([#Bool Bool/encode] [#Nat Nat/encode] [#Int Int/encode] - [#Real Real/encode] + [#Frac Frac/encode] [#Text Text/encode] [#Symbol Ident/encode] [#Tag Tag/encode]) @@ -5208,7 +5208,7 @@ (def: (place-tokens label tokens target) (-> Text (List Code) Code (Maybe (List Code))) (case target - (^or [_ (#Bool _)] [_ (#Nat _)] [_ (#Int _)] [_ (#Deg _)] [_ (#Real _)] [_ (#Text _)] [_ (#Tag _)]) + (^or [_ (#Bool _)] [_ (#Nat _)] [_ (#Int _)] [_ (#Deg _)] [_ (#Frac _)] [_ (#Text _)] [_ (#Tag _)]) (#Some (list target)) [_ (#Symbol [prefix name])] @@ -5257,7 +5257,7 @@ [(bool true) "true" [_ (#;Bool true)]] [(bool false) "false" [_ (#;Bool false)]] [(int 123) "123" [_ (#;Int 123)]] - [(real 123.0) "123.0" [_ (#;Real 123.0)]] + [(frac 123.0) "123.0" [_ (#;Frac 123.0)]] [(text "\n") "\"\\n\"" [_ (#;Text "\n")]] [(tag ["yolo" "lol"]) "#yolo;lol" [_ (#;Tag ["yolo" "lol"])]] [(symbol ["yolo" "lol"]) "yolo;lol" [_ (#;Symbol ["yolo" "lol"])]] @@ -5302,7 +5302,7 @@ ["Nat"] ["Int"] ["Deg"] - ["Real"] + ["Frac"] ["Text"]) (#Named _ type') @@ -5324,7 +5324,7 @@ ["Nat" Nat nat$] ["Int" Int int$] ["Deg" Deg deg$] - ["Real" Real real$] + ["Frac" Frac frac$] ["Text" Text text$]) _ @@ -5362,7 +5362,7 @@ )) (macro: #export (^~ tokens) - {#;doc (doc "Use global defs with simple values, such as text, int, real and bool in place of literals in patterns." + {#;doc (doc "Use global defs with simple values, such as text, int, frac and bool in place of literals in patterns." "The definitions must be properly-qualified (though you may use one of the short-cuts Lux provides)." (def: (empty?' node) (All [K V] (-> (Node K V) Bool)) |