diff options
Diffstat (limited to '')
74 files changed, 507 insertions, 593 deletions
diff --git a/lux-mode/lux-mode.el b/lux-mode/lux-mode.el index 6fcfb3853..ba14caf6e 100644 --- a/lux-mode/lux-mode.el +++ b/lux-mode/lux-mode.el @@ -260,7 +260,7 @@ Called by `imenu--generic-function'." ("\\<-?\\(0\\|[--9][0-9_]*\\)\\(\\.[0-9_]+\\(\\(e\\|E\\)\\(-\\|\\+\\)?[0-9][0-9_]*\\)?\\)?\\>" 0 font-lock-constant-face) ; Frac "ratio" literals ("\\<-?[0-9][0-9_]*/[0-9][0-9_]*\\>" 0 font-lock-constant-face) - ; Deg literals + ; Rev literals ("\\<\\(\\.[0-9][0-9_]*\\)\\>" 0 font-lock-constant-face) ; Tags ("#\\.[a-zA-Z0-9-\\+_=!@\\$%\\^&\\*<>\.,/\\\\\\|':~\\?]+" 0 font-lock-type-face) diff --git a/luxc/src/lux/analyser.clj b/luxc/src/lux/analyser.clj index 641dfa947..56cb8a375 100644 --- a/luxc/src/lux/analyser.clj +++ b/luxc/src/lux/analyser.clj @@ -77,9 +77,9 @@ (|do [_ (&type/check exo-type &type/Int)] (return (&/|list (&&/|meta exo-type cursor (&&/$int ?value))))) - (&/$Deg ?value) - (|do [_ (&type/check exo-type &type/Deg)] - (return (&/|list (&&/|meta exo-type cursor (&&/$deg ?value))))) + (&/$Rev ?value) + (|do [_ (&type/check exo-type &type/Rev)] + (return (&/|list (&&/|meta exo-type cursor (&&/$rev ?value))))) (&/$Frac ?value) (|do [_ (&type/check exo-type &type/Frac)] diff --git a/luxc/src/lux/analyser/base.clj b/luxc/src/lux/analyser/base.clj index 5339f8777..25b73ba1a 100644 --- a/luxc/src/lux/analyser/base.clj +++ b/luxc/src/lux/analyser/base.clj @@ -9,7 +9,7 @@ ("bool" 1) ("nat" 1) ("int" 1) - ("deg" 1) + ("rev" 1) ("frac" 1) ("text" 1) ("variant" 3) diff --git a/luxc/src/lux/analyser/case.clj b/luxc/src/lux/analyser/case.clj index d5a6e43cf..86752d336 100644 --- a/luxc/src/lux/analyser/case.clj +++ b/luxc/src/lux/analyser/case.clj @@ -15,7 +15,7 @@ ("BoolTotal" 2) ("NatTotal" 2) ("IntTotal" 2) - ("DegTotal" 2) + ("RevTotal" 2) ("FracTotal" 2) ("TextTotal" 2) ("TupleTotal" 2) @@ -27,7 +27,7 @@ ("BoolTestAC" 1) ("NatTestAC" 1) ("IntTestAC" 1) - ("DegTestAC" 1) + ("RevTestAC" 1) ("FracTestAC" 1) ("TextTestAC" 1) ("TupleTestAC" 1) @@ -283,10 +283,10 @@ =kont kont] (return (&/T [($IntTestAC ?value) =kont]))) - (&/$Deg ?value) - (|do [_ (&type/check value-type &type/Deg) + (&/$Rev ?value) + (|do [_ (&type/check value-type &type/Rev) =kont kont] - (return (&/T [($DegTestAC ?value) =kont]))) + (return (&/T [($RevTestAC ?value) =kont]))) (&/$Frac ?value) (|do [_ (&type/check value-type &type/Frac) @@ -414,8 +414,8 @@ [($IntTotal total? ?values) ($NoTestAC)] (return ($IntTotal true ?values)) - [($DegTotal total? ?values) ($NoTestAC)] - (return ($DegTotal true ?values)) + [($RevTotal total? ?values) ($NoTestAC)] + (return ($RevTotal true ?values)) [($FracTotal total? ?values) ($NoTestAC)] (return ($FracTotal true ?values)) @@ -441,8 +441,8 @@ [($IntTotal total? ?values) ($StoreTestAC ?idx)] (return ($IntTotal true ?values)) - [($DegTotal total? ?values) ($StoreTestAC ?idx)] - (return ($DegTotal true ?values)) + [($RevTotal total? ?values) ($StoreTestAC ?idx)] + (return ($RevTotal true ?values)) [($FracTotal total? ?values) ($StoreTestAC ?idx)] (return ($FracTotal true ?values)) @@ -474,11 +474,11 @@ [($IntTotal total? ?values) ($IntTestAC ?value)] (return ($IntTotal total? (&/$Cons ?value ?values))) - [($DefaultTotal total?) ($DegTestAC ?value)] - (return ($DegTotal total? (&/|list ?value))) + [($DefaultTotal total?) ($RevTestAC ?value)] + (return ($RevTotal total? (&/|list ?value))) - [($DegTotal total? ?values) ($DegTestAC ?value)] - (return ($DegTotal total? (&/$Cons ?value ?values))) + [($RevTotal total? ?values) ($RevTestAC ?value)] + (return ($RevTotal total? (&/$Cons ?value ?values))) [($DefaultTotal total?) ($FracTestAC ?value)] (return ($FracTotal total? (&/|list ?value))) @@ -563,8 +563,8 @@ (|do [_ (&type/check value-type &type/Int)] (return ?total)) - ($DegTotal ?total _) - (|do [_ (&type/check value-type &type/Deg)] + ($RevTotal ?total _) + (|do [_ (&type/check value-type &type/Rev)] (return ?total)) ($FracTotal ?total _) diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index 1010bf418..37db2a480 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -74,7 +74,7 @@ ("Bool" 1) ("Nat" 1) ("Int" 1) - ("Deg" 1) + ("Rev" 1) ("Frac" 1) ("Text" 1) ("Symbol" 1) @@ -1086,12 +1086,12 @@ (fn [state] (return* state (get$ $cursor state)))) -(def deg-bits 64) +(def rev-bits 64) (let [clean-separators (fn [^String input] (.replaceAll input "_" "")) - deg-text-to-digits (fn [^String input] - (loop [output (vec (repeat deg-bits 0)) + rev-text-to-digits (fn [^String input] + (loop [output (vec (repeat rev-bits 0)) index (dec (.length input))] (if (>= index 0) (let [digit (Byte/parseByte (.substring input index (inc index)))] @@ -1108,50 +1108,50 @@ (int (/ raw 10)) (assoc digits index (rem raw 10)))) digits))) - deg-digit-power (fn [level] - (loop [output (-> (vec (repeat deg-bits 0)) + rev-digit-power (fn [level] + (loop [output (-> (vec (repeat rev-bits 0)) (assoc level 1)) times level] (if (>= times 0) (recur (times5 level output) (dec times)) output))) - deg-digits-lt (fn deg-digits-lt + rev-digits-lt (fn rev-digits-lt ([subject param index] - (and (< index deg-bits) + (and (< index rev-bits) (or (< (get subject index) (get param index)) (and (= (get subject index) (get param index)) - (deg-digits-lt subject param (inc index)))))) + (rev-digits-lt subject param (inc index)))))) ([subject param] - (deg-digits-lt subject param 0))) - deg-digits-sub-once (fn [subject param-digit index] + (rev-digits-lt subject param 0))) + rev-digits-sub-once (fn [subject param-digit index] (if (>= (get subject index) param-digit) (update-in subject [index] #(- % param-digit)) (recur (update-in subject [index] #(- 10 (- param-digit %))) 1 (dec index)))) - deg-digits-sub (fn [subject param] + rev-digits-sub (fn [subject param] (loop [target subject - index (dec deg-bits)] + index (dec rev-bits)] (if (>= index 0) - (recur (deg-digits-sub-once target (get param index) index) + (recur (rev-digits-sub-once target (get param index) index) (dec index)) target))) - deg-digits-to-text (fn [digits] + rev-digits-to-text (fn [digits] (loop [output "" - index (dec deg-bits)] + index (dec rev-bits)] (if (>= index 0) (recur (-> (get digits index) (Character/forDigit 10) (str output)) (dec index)) output))) - add-deg-digit-powers (fn [dl dr] - (loop [index (dec deg-bits) - output (vec (repeat deg-bits 0)) + add-rev-digit-powers (fn [dl dr] + (loop [index (dec rev-bits) + output (vec (repeat rev-bits 0)) carry 0] (if (>= index 0) (let [raw (+ carry @@ -1161,45 +1161,45 @@ (assoc output index (rem raw 10)) (int (/ raw 10)))) output)))] - ;; Based on the LuxRT.encode_deg method - (defn encode-deg [input] + ;; Based on the LuxRT.encode_rev method + (defn encode-rev [input] (if (= 0 input) ".0" - (loop [index (dec deg-bits) - output (vec (repeat deg-bits 0))] + (loop [index (dec rev-bits) + output (vec (repeat rev-bits 0))] (if (>= index 0) (recur (dec index) (if (bit-test input index) - (->> (- (dec deg-bits) index) - deg-digit-power - (add-deg-digit-powers output)) + (->> (- (dec rev-bits) index) + rev-digit-power + (add-rev-digit-powers output)) output)) - (-> output deg-digits-to-text + (-> output rev-digits-to-text (->> (str ".")) (.split "0*$") (aget 0)))))) - ;; Based on the LuxRT.decode_deg method - (defn decode-deg [^String input] + ;; Based on the LuxRT.decode_rev method + (defn decode-rev [^String input] (if (and (.startsWith input ".") - (< (.length input) (inc deg-bits))) + (< (.length input) (inc rev-bits))) (loop [digits-left (-> input (.substring 1) clean-separators - deg-text-to-digits) + rev-text-to-digits) index 0 ouput 0] - (if (< index deg-bits) - (let [power-slice (deg-digit-power index)] - (if (not (deg-digits-lt digits-left power-slice)) - (recur (deg-digits-sub digits-left power-slice) + (if (< index rev-bits) + (let [power-slice (rev-digit-power index)] + (if (not (rev-digits-lt digits-left power-slice)) + (recur (rev-digits-sub digits-left power-slice) (inc index) - (bit-set ouput (- (dec deg-bits) index))) + (bit-set ouput (- (dec rev-bits) index))) (recur digits-left (inc index) ouput))) ouput)) - (throw (str "Bad format for Deg number: " input)))) + (throw (str "Bad format for Rev number: " input)))) ) (defn show-ast [ast] @@ -1213,8 +1213,8 @@ [_ ($Int ?value)] (pr-str ?value) - [_ ($Deg ?value)] - (encode-deg ?value) + [_ ($Rev ?value)] + (encode-rev ?value) [_ ($Frac ?value)] (pr-str ?value) diff --git a/luxc/src/lux/compiler/cache/ann.clj b/luxc/src/lux/compiler/cache/ann.clj index 3111886ba..458146992 100644 --- a/luxc/src/lux/compiler/cache/ann.clj +++ b/luxc/src/lux/compiler/cache/ann.clj @@ -33,7 +33,7 @@ [_ (&/$Int value)] (str "I" value stop) - [_ (&/$Deg value)] + [_ (&/$Rev value)] (str "D" value stop) [_ (&/$Frac value)] @@ -79,7 +79,7 @@ ^:private deserialize-bool "B" &/$Bool Boolean/parseBoolean ^:private deserialize-nat "N" &/$Nat Long/parseLong ^:private deserialize-int "I" &/$Int Long/parseLong - ^:private deserialize-deg "D" &/$Deg Long/parseLong + ^:private deserialize-rev "D" &/$Rev Long/parseLong ^:private deserialize-frac "F" &/$Frac Double/parseDouble ^:private deserialize-text "T" &/$Text identity ) @@ -127,7 +127,7 @@ (or (deserialize-bool input) (deserialize-nat input) (deserialize-int input) - (deserialize-deg input) + (deserialize-rev input) (deserialize-frac input) (deserialize-text input) (deserialize-symbol input) diff --git a/luxc/src/lux/compiler/jvm.clj b/luxc/src/lux/compiler/jvm.clj index 68b0e15b7..a13427bc3 100644 --- a/luxc/src/lux/compiler/jvm.clj +++ b/luxc/src/lux/compiler/jvm.clj @@ -56,8 +56,8 @@ (&o/$int ?value) (&&lux/compile-int ?value) - (&o/$deg ?value) - (&&lux/compile-deg ?value) + (&o/$rev ?value) + (&&lux/compile-rev ?value) (&o/$frac ?value) (&&lux/compile-frac ?value) diff --git a/luxc/src/lux/compiler/jvm/case.clj b/luxc/src/lux/compiler/jvm/case.clj index 38f3ad4fc..79e6c559c 100644 --- a/luxc/src/lux/compiler/jvm/case.clj +++ b/luxc/src/lux/compiler/jvm/case.clj @@ -85,7 +85,7 @@ (.visitInsn Opcodes/LCMP) (.visitJumpInsn Opcodes/IFNE $else)) - (&o/$DegPM _value) + (&o/$RevPM _value) (doto writer stack-peek &&/unwrap-long diff --git a/luxc/src/lux/compiler/jvm/lux.clj b/luxc/src/lux/compiler/jvm/lux.clj index 32824a22d..6a85e1075 100644 --- a/luxc/src/lux/compiler/jvm/lux.clj +++ b/luxc/src/lux/compiler/jvm/lux.clj @@ -39,7 +39,7 @@ compile-nat "java/lang/Long" "J" long compile-int "java/lang/Long" "J" long - compile-deg "java/lang/Long" "J" long + compile-rev "java/lang/Long" "J" long compile-frac "java/lang/Double" "D" double ) diff --git a/luxc/src/lux/lexer.clj b/luxc/src/lux/lexer.clj index 84c925cbc..4ff0af4f2 100644 --- a/luxc/src/lux/lexer.clj +++ b/luxc/src/lux/lexer.clj @@ -12,7 +12,7 @@ ("Bool" 1) ("Nat" 1) ("Int" 1) - ("Deg" 1) + ("Rev" 1) ("Frac" 1) ("Text" 1) ("Symbol" 1) @@ -140,7 +140,7 @@ lex-nat $Nat #"^\+[0-9][0-9_]*" lex-int $Int #"^-?[0-9][0-9_]*" - lex-deg $Deg #"^\.[0-9][0-9_]+" + lex-rev $Rev #"^\.[0-9][0-9_]+" lex-frac $Frac #"^-?[0-9][0-9_]*\.[0-9_]+((e|E)(-|\+)?[0-9][0-9_]*)?" ) @@ -208,7 +208,7 @@ lex-bool lex-nat lex-frac - lex-deg + lex-rev lex-int lex-text lex-symbol diff --git a/luxc/src/lux/optimizer.clj b/luxc/src/lux/optimizer.clj index 25958712f..8f331cc95 100644 --- a/luxc/src/lux/optimizer.clj +++ b/luxc/src/lux/optimizer.clj @@ -9,7 +9,7 @@ ("bool" 1) ("nat" 1) ("int" 1) - ("deg" 1) + ("rev" 1) ("frac" 1) ("text" 1) ("variant" 3) @@ -71,8 +71,8 @@ ("NatPM" 1) ;; Compare the CDN with an integer value. ("IntPM" 1) - ;; Compare the CDN with a degree value. - ("DegPM" 1) + ;; Compare the CDN with a revolution value. + ("RevPM" 1) ;; Compare the CDN with a frac value. ("FracPM" 1) ;; Compare the CDN with a text value. @@ -186,8 +186,8 @@ (&/|list ($IntPM _value) $PopPM) - (&a-case/$DegTestAC _value) - (&/|list ($DegPM _value) + (&a-case/$RevTestAC _value) + (&/|list ($RevPM _value) $PopPM) (&a-case/$FracTestAC _value) @@ -290,9 +290,9 @@ ($IntPM _pre-value) ($AltPM pre post)) - [($DegPM _pre-value) ($DegPM _post-value)] + [($RevPM _pre-value) ($RevPM _post-value)] (if (= _pre-value _post-value) - ($DegPM _pre-value) + ($RevPM _pre-value) ($AltPM pre post)) [($FracPM _pre-value) ($FracPM _post-value)] @@ -1010,8 +1010,8 @@ (&a/$int value) (&/T [meta ($int value)]) - (&a/$deg value) - (&/T [meta ($deg value)]) + (&a/$rev value) + (&/T [meta ($rev value)]) (&a/$frac value) (&/T [meta ($frac value)]) diff --git a/luxc/src/lux/parser.clj b/luxc/src/lux/parser.clj index 6bc2190a7..130a794ac 100644 --- a/luxc/src/lux/parser.clj +++ b/luxc/src/lux/parser.clj @@ -73,8 +73,8 @@ (&lexer/$Int ?value) (return (&/|list (&/T [meta (&/$Int (Long/parseLong ?value))]))) - (&lexer/$Deg ?value) - (return (&/|list (&/T [meta (&/$Deg (&/decode-deg ?value))]))) + (&lexer/$Rev ?value) + (return (&/|list (&/T [meta (&/$Rev (&/decode-rev ?value))]))) (&lexer/$Frac ?value) (return (&/|list (&/T [meta (&/$Frac (Double/parseDouble ?value))]))) diff --git a/luxc/src/lux/type.clj b/luxc/src/lux/type.clj index 173f144b9..d0fcf4691 100644 --- a/luxc/src/lux/type.clj +++ b/luxc/src/lux/type.clj @@ -27,12 +27,12 @@ (&/$UnivQ empty-env (&/$Primitive "#I64" (&/|list (&/$Parameter 1)))))) (def Nat* (&/$Primitive &&host/nat-data-tag &/$Nil)) -(def Deg* (&/$Primitive &&host/deg-data-tag &/$Nil)) +(def Rev* (&/$Primitive &&host/rev-data-tag &/$Nil)) (def Int* (&/$Primitive &&host/int-data-tag &/$Nil)) (def Bool (&/$Named (&/T ["lux" "Bool"]) (&/$Primitive "#Bool" &/$Nil))) (def Nat (&/$Named (&/T ["lux" "Nat"]) (&/$Apply Nat* I64))) -(def Deg (&/$Named (&/T ["lux" "Deg"]) (&/$Apply Deg* I64))) +(def Rev (&/$Named (&/T ["lux" "Rev"]) (&/$Apply Rev* I64))) (def Int (&/$Named (&/T ["lux" "Int"]) (&/$Apply Int* I64))) (def Frac (&/$Named (&/T ["lux" "Frac"]) (&/$Primitive "#Frac" &/$Nil))) (def Text (&/$Named (&/T ["lux" "Text"]) (&/$Primitive "#Text" &/$Nil))) @@ -154,8 +154,8 @@ Nat (&/$Sum ;; "lux;Int" Int - (&/$Sum ;; "lux;Deg" - Deg + (&/$Sum ;; "lux;Rev" + Rev (&/$Sum ;; "lux;Frac" Frac (&/$Sum ;; "lux;Text" diff --git a/luxc/src/lux/type/host.clj b/luxc/src/lux/type/host.clj index bdf0d7b50..474153316 100644 --- a/luxc/src/lux/type/host.clj +++ b/luxc/src/lux/type/host.clj @@ -69,7 +69,7 @@ (def i64-data-tag "#I64") (def nat-data-tag "#Nat") (def int-data-tag "#Int") -(def deg-data-tag "#Deg") +(def rev-data-tag "#Rev") ;; [Utils] (defn ^:private trace-lineage* [^Class super-class ^Class sub-class] diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux index 41e93c13b..9d781429e 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/case.jvm.lux @@ -118,7 +118,7 @@ ([#.Bool _.bool _.equal] [#.Nat (<| _.int (:coerce Int)) _.=] [#.Int _.int _.=] - [#.Deg (<| _.int (:coerce Int)) _.=] + [#.Rev (<| _.int (:coerce Int)) _.=] [#.Frac _.float _.=] [#.Text _.string _.equal]) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux index b002341cc..4e0c617b4 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/expression.jvm.lux @@ -41,7 +41,7 @@ ([#.Bool primitiveT.translate-bool] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg] + [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux index 4e26c4218..1c8c17bed 100644 --- a/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/common-lisp/primitive.jvm.lux @@ -13,14 +13,6 @@ (-> Int (Meta Expression)) (|>> _.int meta/wrap)) -(def: #export translate-nat - (-> Nat (Meta Expression)) - (|>> (:coerce Int) _.int meta/wrap)) - -(def: #export translate-deg - (-> Deg (Meta Expression)) - (|>> (:coerce Int) _.int meta/wrap)) - (def: #export translate-frac (-> Frac (Meta Expression)) (|>> _.double meta/wrap)) diff --git a/new-luxc/source/luxc/lang/translation/js/case.jvm.lux b/new-luxc/source/luxc/lang/translation/js/case.jvm.lux index 3abd8c55c..fc01a9d7c 100644 --- a/new-luxc/source/luxc/lang/translation/js/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/case.jvm.lux @@ -100,7 +100,7 @@ (wrap (format "if(!" (format runtimeT.int//= "(" peek-cursor "," valueJS ")") ") { " fail-pattern-matching " }")))) ([#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg]) + [#.Rev primitiveT.translate-rev]) (^template [<tag> <format>] [_ (<tag> value)] diff --git a/new-luxc/source/luxc/lang/translation/js/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/js/expression.jvm.lux index ba6c63e8f..8a5e73c75 100644 --- a/new-luxc/source/luxc/lang/translation/js/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/expression.jvm.lux @@ -45,7 +45,7 @@ ([#.Bool primitiveT.translate-bool] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg] + [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux index 5fedc9a9e..753f1ce45 100644 --- a/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux @@ -15,27 +15,11 @@ (def: low-mask Nat (dec (bit.left-shift +32 +1))) -(def: #export (translate-nat value) - (-> Nat (Meta Expression)) - (let [high (|> value - (bit.logical-right-shift +32) - .int %i) - low (|> value - (bit.and low-mask) - .int %i)] - (meta/wrap (format runtimeT.int//new "(" high "," low ")")))) - -(def: #export translate-int +(def: #export (translate-int value) (-> Int (Meta Expression)) - (|>> .nat translate-nat)) - -(def: deg-to-nat - (-> Deg Nat) - (|>> (:coerce Nat))) - -(def: #export translate-deg - (-> Deg (Meta Expression)) - (|>> deg-to-nat translate-nat)) + (let [high (|> value (bit.logical-right-shift +32) %i) + low (|> value (bit.and low-mask) %i)] + (meta/wrap (format runtimeT.int//new "(" high "," low ")")))) (def: #export translate-frac (-> Frac (Meta Expression)) diff --git a/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux index f5d288827..18309b0e5 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/case.jvm.lux @@ -79,16 +79,12 @@ ($i.unwrap #$.Boolean) (jumpI @else)))) - (^template [<tag> <prep>] - [_ (<tag> value)] - (macro/wrap (|>> peekI - ($i.unwrap #$.Long) - ($i.long (|> value <prep>)) - $i.LCMP - ($i.IFNE @else)))) - ([#.Nat (:coerce Int)] - [#.Int (: Int)] - [#.Deg (:coerce Int)]) + [_ (#.Int value)] + (macro/wrap (|>> peekI + ($i.unwrap #$.Long) + ($i.long value) + $i.LCMP + ($i.IFNE @else))) [_ (#.Frac value)] (macro/wrap (|>> peekI diff --git a/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux index a72bf0011..70d2330f4 100644 --- a/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/case.jvm.lux @@ -104,7 +104,7 @@ (lua.return! pm-error)))) ([#.Nat (<| lua.int (:coerce Int))] [#.Int lua.int] - [#.Deg (<| lua.int (:coerce Int))] + [#.Rev (<| lua.int (:coerce Int))] [#.Bool lua.bool] [#.Frac lua.float] [#.Text lua.string]) diff --git a/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux index e2c626e83..9632d5708 100644 --- a/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/expression.jvm.lux @@ -45,7 +45,7 @@ ([#.Bool primitiveT.translate-bool] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg] + [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux index 5769f6890..4a6c78b04 100644 --- a/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/lua/primitive.jvm.lux @@ -14,14 +14,6 @@ (-> Int (Meta Expression)) (|>> %i meta/wrap)) -(def: #export translate-nat - (-> Nat (Meta Expression)) - (|>> (:coerce Int) %i meta/wrap)) - -(def: #export translate-deg - (-> Deg (Meta Expression)) - (|>> (:coerce Int) %i meta/wrap)) - (def: #export translate-frac (-> Frac (Meta Expression)) (|>> (cond> [(f/= number.positive-infinity)] diff --git a/new-luxc/source/luxc/lang/translation/php/case.jvm.lux b/new-luxc/source/luxc/lang/translation/php/case.jvm.lux index 6f78637cf..0e0aecb7d 100644 --- a/new-luxc/source/luxc/lang/translation/php/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/case.jvm.lux @@ -114,9 +114,7 @@ [_ (<tag> value)] (meta/wrap (_.when! (_.not (_.= (|> value <format>) cursor-top)) fail-pm!))) - ([#.Nat (<| _.int (:coerce Int))] - [#.Int _.int] - [#.Deg (<| _.int (:coerce Int))] + ([#.Int _.int] [#.Bool _.bool] [#.Frac _.float] [#.Text _.string]) diff --git a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux index cd67be0f0..420775734 100644 --- a/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/php/expression.jvm.lux @@ -37,9 +37,7 @@ [_ (<tag> value)] (|> value <generator>)) ([#.Bool primitiveT.translate-bool] - [#.Nat (<| primitiveT.translate-int (:coerce Int))] [#.Int primitiveT.translate-int] - [#.Deg (<| primitiveT.translate-int (:coerce Int))] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux index aedf2a6e1..8e5b16a88 100644 --- a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux @@ -117,7 +117,7 @@ fail-pm!))) ([#.Nat (<| python.int (:coerce Int))] [#.Int python.int] - [#.Deg (<| python.int (:coerce Int))] + [#.Rev (<| python.int (:coerce Int))] [#.Bool python.bool] [#.Frac python.float] [#.Text python.string]) diff --git a/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux index d153d8953..a1abe59a6 100644 --- a/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux @@ -44,7 +44,7 @@ ([#.Bool primitiveT.translate-bool] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg] + [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux index f1cf731a2..439404893 100644 --- a/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/python/primitive.jvm.lux @@ -11,14 +11,6 @@ (-> Int (Meta Expression)) (|>> python.int meta/wrap)) -(def: #export translate-nat - (-> Nat (Meta Expression)) - (|>> (:coerce Int) python.int meta/wrap)) - -(def: #export translate-deg - (-> Deg (Meta Expression)) - (|>> (:coerce Int) python.int meta/wrap)) - (def: #export translate-frac (-> Frac (Meta Expression)) (|>> python.float meta/wrap)) diff --git a/new-luxc/source/luxc/lang/translation/r/case.jvm.lux b/new-luxc/source/luxc/lang/translation/r/case.jvm.lux index 3aa3d4a8a..fb16b8791 100644 --- a/new-luxc/source/luxc/lang/translation/r/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/case.jvm.lux @@ -126,7 +126,7 @@ fail-pm!))) ([#.Nat (<| runtimeT.int (:coerce Int))] [#.Int runtimeT.int] - [#.Deg (<| runtimeT.int (:coerce Int))]) + [#.Rev (<| runtimeT.int (:coerce Int))]) (^template [<pm> <getter>] (^code (<pm> (~ [_ (#.Nat idx)]))) diff --git a/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux index d68f6055e..cd2227df3 100644 --- a/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/expression.jvm.lux @@ -42,7 +42,7 @@ ([#.Bool primitiveT.translate-bool] [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg] + [#.Rev primitiveT.translate-rev] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux index ad89f2e31..3652dfcfd 100644 --- a/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/primitive.jvm.lux @@ -13,14 +13,6 @@ (-> Int (Meta Expression)) (|>> runtimeT.int meta/wrap)) -(def: #export translate-nat - (-> Nat (Meta Expression)) - (|>> (:coerce Int) runtimeT.int meta/wrap)) - -(def: #export translate-deg - (-> Deg (Meta Expression)) - (|>> (:coerce Int) runtimeT.int meta/wrap)) - (def: #export translate-frac (-> Frac (Meta Expression)) (|>> r.float meta/wrap)) diff --git a/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux index b7b1f131d..2cce1abf5 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/case.jvm.lux @@ -107,9 +107,7 @@ [_ (<tag> value)] (meta/wrap (ruby.when! (ruby.not (ruby.= (|> value <format>) cursor-top)) (ruby.raise pm-error)))) - ([#.Nat (<| ruby.int (:coerce Int))] - [#.Int ruby.int] - [#.Deg (<| ruby.int (:coerce Int))] + ([#.Int ruby.int] [#.Bool ruby.bool] [#.Frac ruby.float] [#.Text ruby.string]) diff --git a/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux index 96728731d..6d829f81c 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/expression.jvm.lux @@ -42,9 +42,7 @@ [_ (<tag> value)] (<generator> value)) ([#.Bool primitiveT.translate-bool] - [#.Nat primitiveT.translate-nat] [#.Int primitiveT.translate-int] - [#.Deg primitiveT.translate-deg] [#.Frac primitiveT.translate-frac] [#.Text primitiveT.translate-text]) diff --git a/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux index 1f05cf2fd..f84c700d4 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/primitive.jvm.lux @@ -14,14 +14,6 @@ (-> Int (Meta Expression)) (|>> %i meta/wrap)) -(def: #export translate-nat - (-> Nat (Meta Expression)) - (|>> (:coerce Int) %i meta/wrap)) - -(def: #export translate-deg - (-> Deg (Meta Expression)) - (|>> (:coerce Int) %i meta/wrap)) - (def: #export translate-frac (-> Frac (Meta Expression)) (|>> (cond> [(f/= number.positive-infinity)] diff --git a/new-luxc/source/luxc/repl.lux b/new-luxc/source/luxc/repl.lux index a6579e939..2fb62a3b4 100644 --- a/new-luxc/source/luxc/repl.lux +++ b/new-luxc/source/luxc/repl.lux @@ -113,7 +113,7 @@ [Bool %b] [Nat %n] [Int %i] - [Deg %d] + [Rev %r] [Frac %f] [Text %t]))))) diff --git a/new-luxc/test/test/luxc/lang/analysis/type.lux b/new-luxc/test/test/luxc/lang/analysis/type.lux index 3826b1e5d..a026f8df2 100644 --- a/new-luxc/test/test/luxc/lang/analysis/type.lux +++ b/new-luxc/test/test/luxc/lang/analysis/type.lux @@ -39,7 +39,7 @@ [r.bool (+0 "#Bool" (+0)) code.bool] [r.nat (+0 "#Nat" (+0)) code.nat] [r.int (+0 "#Int" (+0)) code.int] - [r.deg (+0 "#Deg" (+0)) code.deg] + [r.rev (+0 "#Rev" (+0)) code.rev] [r.frac (+0 "#Frac" (+0)) code.frac] [(r.text +5) (+0 "#Text" (+0)) code.text] )] @@ -68,7 +68,7 @@ ([#.Bool bool/=] [#.Nat n/=] [#.Int i/=] - [#.Deg d/=] + [#.Rev r/=] [#.Frac f/=] [#.Text text/=]) diff --git a/new-luxc/test/test/luxc/lang/translation/primitive.lux b/new-luxc/test/test/luxc/lang/translation/primitive.lux index 5d368cc60..43886e197 100644 --- a/new-luxc/test/test/luxc/lang/translation/primitive.lux +++ b/new-luxc/test/test/luxc/lang/translation/primitive.lux @@ -19,7 +19,7 @@ [%bool% r.bool %nat% r.nat %int% r.int - %deg% r.deg + %rev% r.rev %frac% r.frac %text% (r.ascii +5)] (`` ($_ seq diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index d68ef26ad..6ec614fb5 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -116,9 +116,9 @@ [dummy-cursor (+5 "Your standard, run-of-the-mill integer numbers.")]] #Nil))))]) -("lux def" Deg - (+10 ["lux" "Deg"] - (+0 "#I64" (#Cons (+0 "#Deg" #Nil) #Nil))) +("lux def" Rev + (+10 ["lux" "Rev"] + (+0 "#I64" (#Cons (+0 "#Rev" #Nil) #Nil))) [dummy-cursor (+10 (#Cons [[dummy-cursor (+7 ["lux" "type?"])] [dummy-cursor (+0 true)]] @@ -309,7 +309,7 @@ ## (#Bool Bool) ## (#Nat Nat) ## (#Int Int) -## (#Deg Deg) +## (#Rev Rev) ## (#Frac Frac) ## (#Text Text) ## (#Symbol Text Text) @@ -332,8 +332,8 @@ Nat (#Sum ## "lux.Int" Int - (#Sum ## "lux.Deg" - Deg + (#Sum ## "lux.Rev" + Rev (#Sum ## "lux.Frac" Frac (#Sum ## "lux.Text" @@ -355,7 +355,7 @@ [dummy-cursor (+9 (#Cons [dummy-cursor (+5 "Bool")] (#Cons [dummy-cursor (+5 "Nat")] (#Cons [dummy-cursor (+5 "Int")] - (#Cons [dummy-cursor (+5 "Deg")] + (#Cons [dummy-cursor (+5 "Rev")] (#Cons [dummy-cursor (+5 "Frac")] (#Cons [dummy-cursor (+5 "Text")] (#Cons [dummy-cursor (+5 "Symbol")] @@ -411,9 +411,9 @@ ("lux function" _ value (_ann (#Int value)))) [dummy-cursor (#Record #Nil)]) -("lux def" deg$ - ("lux check" (#Function Deg Code) - ("lux function" _ value (_ann (#Deg value)))) +("lux def" rev$ + ("lux check" (#Function Rev Code) + ("lux function" _ value (_ann (#Rev value)))) [dummy-cursor (#Record #Nil)]) ("lux def" frac$ @@ -1900,8 +1900,8 @@ [_ [_ (#Int value)]] (return (wrap-meta (form$ (list (tag$ ["lux" "Int"]) (int$ value))))) - [_ [_ (#Deg value)]] - (return (wrap-meta (form$ (list (tag$ ["lux" "Deg"]) (deg$ value))))) + [_ [_ (#Rev value)]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Rev"]) (rev$ value))))) [_ [_ (#Frac value)]] (return (wrap-meta (form$ (list (tag$ ["lux" "Frac"]) (frac$ value))))) @@ -2294,39 +2294,39 @@ _ (fail "Wrong syntax for do-template")})) -(def:''' #export (d/= test subject) +(def:''' #export (r/= test subject) (list [(tag$ ["lux" "doc"]) - (text$ "Deg(ree) equality.")]) - (-> Deg Deg Bool) + (text$ "Rev(olution) equality.")]) + (-> Rev Rev Bool) ("lux i64 =" test subject)) -(def:''' #export (d/< test subject) +(def:''' #export (r/< test subject) (list [(tag$ ["lux" "doc"]) - (text$ "Deg(ree) less-than.")]) - (-> Deg Deg Bool) + (text$ "Rev(olution) less-than.")]) + (-> Rev Rev Bool) (n/< ("lux coerce" Nat test) ("lux coerce" Nat subject))) -(def:''' #export (d/<= test subject) +(def:''' #export (r/<= test subject) (list [(tag$ ["lux" "doc"]) - (text$ "Deg(ree) less-than-equal.")]) - (-> Deg Deg Bool) + (text$ "Rev(olution) less-than-equal.")]) + (-> Rev Rev Bool) (if (n/< ("lux coerce" Nat test) ("lux coerce" Nat subject)) true ("lux i64 =" test subject))) -(def:''' #export (d/> test subject) +(def:''' #export (r/> test subject) (list [(tag$ ["lux" "doc"]) - (text$ "Deg(ree) greater-than.")]) - (-> Deg Deg Bool) - (d/< subject test)) + (text$ "Rev(olution) greater-than.")]) + (-> Rev Rev Bool) + (r/< subject test)) -(def:''' #export (d/>= test subject) +(def:''' #export (r/>= test subject) (list [(tag$ ["lux" "doc"]) - (text$ "Deg(ree) greater-than-equal.")]) - (-> Deg Deg Bool) - (if (d/< subject test) + (text$ "Rev(olution) greater-than-equal.")]) + (-> Rev Rev Bool) + (if (r/< subject test) true ("lux i64 =" test subject))) @@ -2424,8 +2424,8 @@ [ Int i/+ "lux i64 +" "Int(eger) addition."] [ Int i/- "lux i64 -" "Int(eger) substraction."] - [ Deg d/+ "lux i64 +" "Deg(ree) addition."] - [ Deg d/- "lux i64 -" "Deg(ree) substraction."] + [ Rev r/+ "lux i64 +" "Rev(olution) addition."] + [ Rev r/- "lux i64 -" "Rev(olution) substraction."] ) (do-template [<type> <name> <op> <doc>] @@ -2446,10 +2446,10 @@ [Frac f/% "lux frac %" "Frac(tion) remainder."] ) -(def:''' #export (d/* param subject) +(def:''' #export (r/* param subject) (list [(tag$ ["lux" "doc"]) - (text$ "Deg(ree) multiplication.")]) - (-> Deg Deg Deg) + (text$ "Rev(olution) multiplication.")]) + (-> Rev Rev Rev) (let' [subjectH (high-bits subject) subjectL (low-bits subject) paramH (high-bits param) @@ -2479,12 +2479,12 @@ ("lux i64 logical-right-shift" +1 remaining)) [count remaining])) -(def:''' #export (d// param subject) +(def:''' #export (r// param subject) (list [(tag$ ["lux" "doc"]) - (text$ "Deg(ree) division.")]) - (-> Deg Deg Deg) + (text$ "Rev(olution) division.")]) + (-> Rev Rev Rev) (if ("lux i64 =" 0 param) - ("lux io error" "Cannot divide Deg by zero!") + ("lux io error" "Cannot divide Rev by zero!") (let' [[trailing-zeroes remaining] (without-trailing-zeroes +0 ("lux coerce" Nat param)) [trailing-zeroes denominator] ("lux check" (#Product Nat Nat) (if ("lux i64 =" 0 trailing-zeroes) @@ -2492,35 +2492,35 @@ [trailing-zeroes remaining])) shift ("lux i64 -" trailing-zeroes +64) numerator ("lux i64 left-shift" shift +1)] - ("lux coerce" Deg + ("lux coerce" Rev ("lux int *" ("lux coerce" Int subject) ("lux int /" ("lux coerce" Int numerator) ("lux coerce" Int denominator))))))) -(def:''' #export (d/% param subject) +(def:''' #export (r/% param subject) (list [(tag$ ["lux" "doc"]) - (text$ "Deg(ree) remainder.")]) - (-> Deg Deg Deg) - ("lux coerce" Deg + (text$ "Rev(olution) remainder.")]) + (-> Rev Rev Rev) + ("lux coerce" Rev (n/% ("lux coerce" Nat subject) ("lux coerce" Nat param)))) -(def:''' #export (d/scale param subject) +(def:''' #export (r/scale param subject) (list [(tag$ ["lux" "doc"]) - (text$ "Deg(ree) scale.")]) - (-> Nat Deg Deg) - ("lux coerce" Deg + (text$ "Rev(olution) scale.")]) + (-> Nat Rev Rev) + ("lux coerce" Rev ("lux int *" ("lux coerce" Int subject) ("lux coerce" Int param)))) -(def:''' #export (d/reciprocal numerator) +(def:''' #export (r/reciprocal numerator) (list [(tag$ ["lux" "doc"]) - (text$ "Deg(ree) reciprocal of a Nat(ural).")]) - (-> Nat Deg) - ("lux coerce" Deg + (text$ "Rev(olution) reciprocal of a Nat(ural).")]) + (-> Nat Rev) + ("lux coerce" Rev (let' [[trailing-zeroes remaining] (without-trailing-zeroes +0 numerator)] (n// remaining ("lux case" trailing-zeroes @@ -2542,8 +2542,8 @@ [i/min Int i/< "Int(eger) minimum."] [i/max Int i/> "Int(eger) maximum."] - [d/min Deg d/< "Deg(ree) minimum."] - [d/max Deg d/> "Deg(ree) maximum."] + [r/min Rev r/< "Rev(olution) minimum."] + [r/max Rev r/> "Rev(olution) maximum."] [f/min Frac f/< "Frac(tion) minimum."] [f/max Frac f/> "Frac(tion) minimum."] @@ -3053,7 +3053,7 @@ [_ (#Int value)] (int/encode value) - [_ (#Deg value)] + [_ (#Rev value)] ("lux io error" "Undefined behavior.") [_ (#Frac value)] @@ -3285,8 +3285,8 @@ [_ (#Int value)] (meta-code ["lux" "Int"] (int$ value)) - [_ (#Deg value)] - (meta-code ["lux" "Deg"] (deg$ value)) + [_ (#Rev value)] + (meta-code ["lux" "Rev"] (rev$ value)) [_ (#Frac value)] (meta-code ["lux" "Frac"] (frac$ value)) @@ -5267,7 +5267,7 @@ ([#Bool] [#Nat] [#Int] - [#Deg] + [#Rev] [#Frac] [#Text] [#Symbol] @@ -5334,7 +5334,7 @@ [i64 I64] [nat Nat] [int Int] - [deg Deg] + [rev Rev] ) (def: (repeat n x) @@ -5400,7 +5400,7 @@ [#Tuple "[" "]" id] [#Record "{" "}" rejoin-all-pairs]) - [new-cursor (#Deg value)] + [new-cursor (#Rev value)] ("lux io error" "Undefined behavior.") )) @@ -5589,7 +5589,7 @@ (def: (place-tokens label tokens target) (-> Text (List Code) Code (Maybe (List Code))) (case target - (^or [_ (#Bool _)] [_ (#Nat _)] [_ (#Int _)] [_ (#Deg _)] [_ (#Frac _)] [_ (#Text _)] [_ (#Tag _)]) + (^or [_ (#Bool _)] [_ (#Nat _)] [_ (#Int _)] [_ (#Rev _)] [_ (#Frac _)] [_ (#Text _)] [_ (#Tag _)]) (#Some (list target)) [_ (#Symbol [prefix name])] @@ -5682,7 +5682,7 @@ (["Bool"] ["Nat"] ["Int"] - ["Deg"] + ["Rev"] ["Frac"] ["Text"]) @@ -5704,7 +5704,7 @@ (["Bool" Bool bool$] ["Nat" Nat nat$] ["Int" Int int$] - ["Deg" Deg deg$] + ["Rev" Rev rev$] ["Frac" Frac frac$] ["Text" Text text$]) @@ -6227,7 +6227,7 @@ ([#Bool "Bool" bool$] [#Nat "Nat" nat$] [#Int "Int" int$] - [#Deg "Deg" deg$] + [#Rev "Rev" rev$] [#Frac "Frac" frac$] [#Text "Text" text$] [#Tag "Tag" ident$] @@ -6304,7 +6304,7 @@ (<%> param subject)])] [Int i//% i// i/%] - [Deg d//% d// d/%] + [Rev r//% r// r/%] [Frac f//% f// f/%] ) @@ -6313,22 +6313,22 @@ (|>> ("lux i64 logical-right-shift" +11) int-to-frac)) -(def: deg-denominator Frac (to-significand -1)) +(def: rev-denominator Frac (to-significand -1)) -(def: #export (frac-to-deg input) - (-> Frac Deg) +(def: #export (frac-to-rev input) + (-> Frac Rev) (let [abs (if (f/< 0.0 input) (f/* -1.0 input) input)] (|> abs (f/% 1.0) - (f/* deg-denominator) + (f/* rev-denominator) frac-to-int ("lux i64 left-shift" +11)))) -(def: #export deg-to-frac - (-> Deg Frac) - (|>> to-significand (f// deg-denominator))) +(def: #export rev-to-frac + (-> Rev Frac) + (|>> to-significand (f// rev-denominator))) (macro: #export (alias: tokens) (case tokens diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux index 70756c5c6..fb1e903b2 100644 --- a/stdlib/source/lux/control/concatenative.lux +++ b/stdlib/source/lux/control/concatenative.lux @@ -1,7 +1,7 @@ (.module: [lux #- if loop when n/+ n/- n/* n// n/% n/= n/< n/<= n/> n/>= i/+ i/- i/* i// i/% i/= i/< i/<= i/> i/>= - d/+ d/- d/* d// d/% d/= d/< d/<= d/> d/>= + r/+ r/- r/* r// r/% r/= r/< r/<= r/> r/>= f/+ f/- f/* f// f/% f/= f/< f/<= f/> f/>=] (lux (control ["p" parser "p/" Monad<Parser>] [monad]) @@ -98,7 +98,7 @@ (case command (^or [_ (#.Bool _)] [_ (#.Nat _)] [_ (#.Int _)] - [_ (#.Deg _)] [_ (#.Frac _)] + [_ (#.Rev _)] [_ (#.Frac _)] [_ (#.Text _)] [_ (#.Tag _)] (^ [_ (#.Form (list [_ (#.Tag _)]))])) (` (..push (~ command))) @@ -222,16 +222,16 @@ [Int Bool i/> .i/>] [Int Bool i/>= .i/>=] - [Deg Deg d/+ .d/+] - [Deg Deg d/- .d/-] - [Deg Deg d/* .d/*] - [Deg Deg d// .d//] - [Deg Deg d/% .d/%] - [Deg Bool d/= .d/=] - [Deg Bool d/< .d/<] - [Deg Bool d/<= .d/<=] - [Deg Bool d/> .d/>] - [Deg Bool d/>= .d/>=] + [Rev Rev r/+ .r/+] + [Rev Rev r/- .r/-] + [Rev Rev r/* .r/*] + [Rev Rev r// .r//] + [Rev Rev r/% .r/%] + [Rev Bool r/= .r/=] + [Rev Bool r/< .r/<] + [Rev Bool r/<= .r/<=] + [Rev Bool r/> .r/>] + [Rev Bool r/>= .r/>=] [Frac Frac f/+ .f/+] [Frac Frac f/- .f/-] diff --git a/stdlib/source/lux/data/format/css.lux b/stdlib/source/lux/data/format/css.lux index 360ef416f..d76242045 100644 --- a/stdlib/source/lux/data/format/css.lux +++ b/stdlib/source/lux/data/format/css.lux @@ -46,14 +46,14 @@ ")"))) (def: #export (rgba color alpha) - (-> Color Deg Value) + (-> Color Rev Value) (let [[red green blue] (color.unpack color)] (format "rgba(" (|> red .int %i) "," (|> green .int %i) "," (|> blue .int %i) - "," (if (d/= (:: number.Interval<Deg> top) alpha) + "," (if (r/= (:: number.Interval<Rev> top) alpha) "1.0" - (format "0" (%d alpha))) + (format "0" (%r alpha))) ")"))) (def: #export (rule selector style children) diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 4ac938ac2..8c9e663cb 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -19,7 +19,7 @@ [ Nat n/=] [ Int i/=] - [ Deg d/=] + [ Rev r/=] [Frac f/=] ) @@ -33,7 +33,7 @@ [ Nat Eq<Nat> n/< n/<= n/> n/>=] [ Int Eq<Int> i/< i/<= i/> i/>=] - [Deg Eq<Deg> d/< d/<= d/> d/>=] + [Rev Eq<Rev> r/< r/<= r/> r/>=] [Frac Eq<Frac> f/< f/<= f/> f/>=] ) @@ -74,16 +74,16 @@ [Frac Order<Frac> f/+ f/- f/* f// f/% f/= f/< 0.0 1.0 -1.0] ) -(struct: #export _ (Number Deg) - (def: + d/+) - (def: - d/-) - (def: * d/*) - (def: / d//) - (def: % d/%) - (def: (negate x) (d/- x (:coerce Deg -1))) +(struct: #export _ (Number Rev) + (def: + r/+) + (def: - r/-) + (def: * r/*) + (def: / r//) + (def: % r/%) + (def: (negate x) (r/- x (:coerce Rev -1))) (def: abs id) (def: (signum x) - (:coerce Deg -1))) + (:coerce Rev -1))) (do-template [<type> <order> <succ> <pred>] [(struct: #export _ (Enum <type>) @@ -94,7 +94,7 @@ [Nat Order<Nat> inc dec] [Int Order<Int> inc dec] [Frac Order<Frac> (f/+ ("lux frac smallest")) (f/- ("lux frac smallest"))] - [Deg Order<Deg> inc dec] + [Rev Order<Rev> inc dec] ) (do-template [<type> <enum> <top> <bottom>] @@ -106,7 +106,7 @@ [ Nat Enum<Nat> (:coerce Nat -1) +0] [ Int Enum<Int> 9_223_372_036_854_775_807 -9_223_372_036_854_775_808] [Frac Enum<Frac> ("lux frac max") ("lux frac min")] - [ Deg Enum<Deg> (:coerce Deg -1) (:coerce Deg +0)] + [ Rev Enum<Rev> (:coerce Rev -1) (:coerce Rev +0)] ) (do-template [<name> <type> <identity> <compose>] @@ -126,10 +126,10 @@ [Mul@Monoid<Frac> Frac 1.0 f/*] [Max@Monoid<Frac> Frac (:: Interval<Frac> bottom) f/max] [Min@Monoid<Frac> Frac (:: Interval<Frac> top) f/min] - [ Add@Monoid<Deg> Deg (:: Interval<Deg> bottom) d/+] - [ Mul@Monoid<Deg> Deg (:: Interval<Deg> top) d/*] - [ Max@Monoid<Deg> Deg (:: Interval<Deg> bottom) d/max] - [ Min@Monoid<Deg> Deg (:: Interval<Deg> top) d/min] + [ Add@Monoid<Rev> Rev (:: Interval<Rev> bottom) r/+] + [ Mul@Monoid<Rev> Rev (:: Interval<Rev> top) r/*] + [ Max@Monoid<Rev> Rev (:: Interval<Rev> bottom) r/max] + [ Min@Monoid<Rev> Rev (:: Interval<Rev> top) r/min] ) (do-template [<name> <numerator> <doc>] @@ -379,7 +379,7 @@ (maybe.assume ("lux text clip" input +1 ("lux text size" input)))) (do-template [<struct> <nat> <char-bit-size> <error>] - [(struct: #export <struct> (Codec Text Deg) + [(struct: #export <struct> (Codec Text Rev) (def: (encode value) (let [raw-output (de-prefix (:: <nat> encode (:coerce Nat value))) max-num-chars (n// <char-bit-size> +64) @@ -400,15 +400,15 @@ (^multi (^ (#.Some (char "."))) [(:: <nat> decode ("lux text concat" "+" (de-prefix repr))) (#e.Success output)]) - (#e.Success (:coerce Deg output)) + (#e.Success (:coerce Rev output)) _ (#e.Error ("lux text concat" <error> repr))) (#e.Error ("lux text concat" <error> repr))))))] - [Binary@Codec<Text,Deg> Binary@Codec<Text,Nat> +1 "Invalid binary syntax: "] - [Octal@Codec<Text,Deg> Octal@Codec<Text,Nat> +3 "Invalid octal syntax: "] - [Hex@Codec<Text,Deg> Hex@Codec<Text,Nat> +4 "Invalid hexadecimal syntax: "] + [Binary@Codec<Text,Rev> Binary@Codec<Text,Nat> +1 "Invalid binary syntax: "] + [Octal@Codec<Text,Rev> Octal@Codec<Text,Nat> +3 "Invalid octal syntax: "] + [Hex@Codec<Text,Rev> Hex@Codec<Text,Nat> +4 "Invalid hexadecimal syntax: "] ) (do-template [<struct> <int> <base> <char-set> <error>] @@ -449,9 +449,9 @@ (recur (dec muls-left) (f/* <base> output)))) adjusted-decimal (|> decimal int-to-frac (f// div-power)) - dec-deg (case (:: Hex@Codec<Text,Deg> decode ("lux text concat" "." decimal-part)) - (#e.Success dec-deg) - dec-deg + dec-rev (case (:: Hex@Codec<Text,Rev> decode ("lux text concat" "." decimal-part)) + (#e.Success dec-rev) + dec-rev (#e.Error error) (error! error))] @@ -652,7 +652,7 @@ (let [encoding ($_ "lux text concat" "Given syntax for a " encoding - " number, generates a Nat, an Int, a Deg or a Frac.") + " number, generates a Nat, an Int, a Rev or a Frac.") underscore "Allows for the presence of underscore in the numbers." description [cursor (#.Text ($_ "lux text concat" encoding "\n" @@ -677,7 +677,7 @@ (-> Text Text) ("lux text replace-all" number "_" "")) -(do-template [<macro> <nat> <int> <deg> <frac> <error> <doc>] +(do-template [<macro> <nat> <int> <rev> <frac> <error> <doc>] [(macro: #export (<macro> tokens state) {#.doc <doc>} (case tokens @@ -694,8 +694,8 @@ (#e.Success [state (list [meta (#.Int value)])]) (^multi (#e.Error _) - [(:: <deg> decode repr) (#e.Success value)]) - (#e.Success [state (list [meta (#.Deg value)])]) + [(:: <rev> decode repr) (#e.Success value)]) + (#e.Success [state (list [meta (#.Rev value)])]) (^multi (#e.Error _) [(:: <frac> decode repr) (#e.Success value)]) @@ -707,21 +707,21 @@ _ (#e.Error <error>)))] - [bin Binary@Codec<Text,Nat> Binary@Codec<Text,Int> Binary@Codec<Text,Deg> Binary@Codec<Text,Frac> + [bin Binary@Codec<Text,Nat> Binary@Codec<Text,Int> Binary@Codec<Text,Rev> Binary@Codec<Text,Frac> "Invalid binary syntax." (encoding-doc "binary" (bin "11001001") (bin "11_00_10_01"))] - [oct Octal@Codec<Text,Nat> Octal@Codec<Text,Int> Octal@Codec<Text,Deg> Octal@Codec<Text,Frac> + [oct Octal@Codec<Text,Nat> Octal@Codec<Text,Int> Octal@Codec<Text,Rev> Octal@Codec<Text,Frac> "Invalid octal syntax." (encoding-doc "octal" (oct "615243") (oct "615_243"))] - [hex Hex@Codec<Text,Nat> Hex@Codec<Text,Int> Hex@Codec<Text,Deg> Hex@Codec<Text,Frac> + [hex Hex@Codec<Text,Nat> Hex@Codec<Text,Int> Hex@Codec<Text,Rev> Hex@Codec<Text,Frac> "Invalid hexadecimal syntax." (encoding-doc "hexadecimal" (hex "deadBEEF") (hex "dead_BEEF"))] ) -## The following code allows one to encode/decode Deg numbers as text. -## This is not a simple algorithm, and it requires subverting the Deg +## The following code allows one to encode/decode Rev numbers as text. +## This is not a simple algorithm, and it requires subverting the Rev ## abstraction a bit. -## It takes into account the fact that Deg numbers are represented by +## It takes into account the fact that Rev numbers are represented by ## Lux as 64-bit integers. ## A valid way to model them is as Lux's Nat type. ## This is a somewhat hackish way to do things, but it allows one to @@ -853,7 +853,7 @@ (digits-sub-once! idx (digits-get idx param) output)) output))) -(struct: #export _ (Codec Text Deg) +(struct: #export _ (Codec Text Rev) (def: (encode input) (let [input (:coerce Nat input) last-idx (dec bit.width)] @@ -897,11 +897,11 @@ (recur (digits-sub! power digits) (inc idx) (bit.set (n/- idx (dec bit.width)) output)))) - (#e.Success (:coerce Deg output)))) + (#e.Success (:coerce Rev output)))) #.None - (#e.Error ("lux text concat" "Wrong syntax for Deg: " input))) - (#e.Error ("lux text concat" "Wrong syntax for Deg: " input)))) + (#e.Error ("lux text concat" "Wrong syntax for Rev: " input))) + (#e.Error ("lux text concat" "Wrong syntax for Rev: " input)))) )) (def: (log2 input) @@ -1007,6 +1007,6 @@ (def: hash frac-to-bits)) -(struct: #export _ (Hash Deg) - (def: eq Eq<Deg>) +(struct: #export _ (Hash Rev) + (def: eq Eq<Rev>) (def: hash (|>> (:coerce Nat)))) diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux index 52cf8066f..792d2ce53 100644 --- a/stdlib/source/lux/data/number/complex.lux +++ b/stdlib/source/lux/data/number/complex.lux @@ -37,7 +37,7 @@ (or (number.not-a-number? (get@ #real complex)) (number.not-a-number? (get@ #imaginary complex)))) -(def: #export (c/= param input) +(def: #export (= param input) (-> Complex Complex Bool) (and (f/= (get@ #real param) (get@ #real input)) @@ -52,19 +52,19 @@ #imaginary (<op> (get@ #imaginary param) (get@ #imaginary input))})] - [c/+ f/+] - [c/- f/-] + [+ f/+] + [- f/-] ) (struct: #export _ (Eq Complex) - (def: = c/=)) + (def: = ..=)) -(def: #export c/negate +(def: #export negate (-> Complex Complex) (|>> (update@ #real frac/negate) (update@ #imaginary frac/negate))) -(def: #export c/signum +(def: #export signum (-> Complex Complex) (|>> (update@ #real frac/signum) (update@ #imaginary frac/signum))) @@ -73,14 +73,14 @@ (-> Complex Complex) (update@ #imaginary frac/negate)) -(def: #export (c/*' param input) +(def: #export (*' param input) (-> Frac Complex Complex) {#real (f/* param (get@ #real input)) #imaginary (f/* param (get@ #imaginary input))}) -(def: #export (c/* param input) +(def: #export (* param input) (-> Complex Complex Complex) {#real (f/- (f/* (get@ #imaginary param) (get@ #imaginary input)) @@ -91,7 +91,7 @@ (f/* (get@ #imaginary param) (get@ #real input)))}) -(def: #export (c// param input) +(def: #export (/ param input) (-> Complex Complex Complex) (let [(^slots [#real #imaginary]) param] (if (f/< (frac/abs imaginary) @@ -105,20 +105,20 @@ {#real (|> (get@ #imaginary input) (f/* quot) (f/+ (get@ #real input)) (f// denom)) #imaginary (|> (get@ #imaginary input) (f/- (f/* quot (get@ #real input))) (f// denom))})))) -(def: #export (c//' param subject) +(def: #export (/' param subject) (-> Frac Complex Complex) (let [(^slots [#real #imaginary]) subject] {#real (f// param real) #imaginary (f// param imaginary)})) -(def: #export (c/% param input) +(def: #export (% param input) (-> Complex Complex Complex) - (let [scaled (c// param input) + (let [scaled (/ param input) quotient (|> scaled (update@ #real math.floor) (update@ #imaginary math.floor))] - (c/- (c/* quotient param) - input))) + (- (* quotient param) + input))) (def: #export (cos subject) (-> Complex Complex) @@ -170,7 +170,7 @@ {#real (f// d (math.sinh r2)) #imaginary (f// d (math.sin i2))})) -(def: #export (c/abs subject) +(def: #export (abs subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] (complex (if (f/< (frac/abs imaginary) @@ -188,16 +188,16 @@ )))) (struct: #export _ (Number Complex) - (def: + c/+) - (def: - c/-) - (def: * c/*) - (def: / c//) - (def: % c/%) + (def: + ..+) + (def: - ..-) + (def: * ..*) + (def: / ../) + (def: % ..%) (def: (negate x) (|> x (update@ #real frac/negate) (update@ #imaginary frac/negate))) - (def: abs c/abs) + (def: abs ..abs) (def: (signum x) (|> x (update@ #real frac/signum) @@ -213,7 +213,7 @@ (def: #export (log subject) (-> Complex Complex) (let [(^slots [#real #imaginary]) subject] - {#real (|> subject c/abs (get@ #real) math.log) + {#real (|> subject ..abs (get@ #real) math.log) #imaginary (math.atan2 real imaginary)})) (do-template [<name> <type> <op>] @@ -221,8 +221,8 @@ (-> <type> Complex Complex) (|> input log (<op> param) exp))] - [pow Complex c/*] - [pow' Frac c/*'] + [pow Complex ..*] + [pow' Frac ..*'] ) (def: (copy-sign sign magnitude) @@ -231,7 +231,7 @@ (def: #export (root2 (^@ input (^slots [#real #imaginary]))) (-> Complex Complex) - (let [t (|> input c/abs (get@ #real) (f/+ (frac/abs real)) (f// 2.0) (math.pow 0.5))] + (let [t (|> input ..abs (get@ #real) (f/+ (frac/abs real)) (f// 2.0) (math.pow 0.5))] (if (f/>= 0.0 real) {#real t #imaginary (f// (f/* 2.0 t) @@ -242,7 +242,7 @@ (def: #export (root2-1z input) (-> Complex Complex) - (|> (complex 1.0) (c/- (c/* input input)) root2)) + (|> (complex 1.0) (- (* input input)) root2)) (def: #export (reciprocal (^slots [#real #imaginary])) (-> Complex Complex) @@ -262,25 +262,25 @@ (def: #export (acos input) (-> Complex Complex) (|> input - (c/+ (|> input root2-1z (c/* i))) + (+ (|> input root2-1z (* i))) log - (c/* (c/negate i)))) + (* (negate i)))) (def: #export (asin input) (-> Complex Complex) (|> input root2-1z - (c/+ (c/* i input)) + (+ (* i input)) log - (c/* (c/negate i)))) + (* (negate i)))) (def: #export (atan input) (-> Complex Complex) (|> input - (c/+ i) - (c// (c/- input i)) + (+ i) + (/ (- input i)) log - (c/* (c// (complex 2.0) i)))) + (* (/ (complex 2.0) i)))) (def: #export (argument (^slots [#real #imaginary])) (-> Complex Frac) @@ -291,7 +291,7 @@ (if (n/= +0 nth) (list) (let [r-nth (|> nth .int int-to-frac) - nth-root-of-abs (|> input c/abs (get@ #real) (math.pow (f// r-nth 1.0))) + nth-root-of-abs (|> input abs (get@ #real) (math.pow (f// r-nth 1.0))) nth-phi (|> input argument (f// r-nth)) slice (|> math.pi (f/* 2.0) (f// r-nth))] (|> (list.n/range +0 (dec nth)) diff --git a/stdlib/source/lux/data/number/ratio.lux b/stdlib/source/lux/data/number/ratio.lux index 9d241fe89..6d241064a 100644 --- a/stdlib/source/lux/data/number/ratio.lux +++ b/stdlib/source/lux/data/number/ratio.lux @@ -27,21 +27,21 @@ {#numerator (n// common numerator) #denominator (n// common denominator)})) -(def: #export (r/* param input) +(def: #export (* param input) (-> Ratio Ratio Ratio) (normalize [(n/* (get@ #numerator param) (get@ #numerator input)) (n/* (get@ #denominator param) (get@ #denominator input))])) -(def: #export (r// param input) +(def: #export (/ param input) (-> Ratio Ratio Ratio) (normalize [(n/* (get@ #denominator param) (get@ #numerator input)) (n/* (get@ #numerator param) (get@ #denominator input))])) -(def: #export (r/+ param input) +(def: #export (+ param input) (-> Ratio Ratio Ratio) (normalize [(n/+ (n/* (get@ #denominator input) (get@ #numerator param)) @@ -50,7 +50,7 @@ (n/* (get@ #denominator param) (get@ #denominator input))])) -(def: #export (r/- param input) +(def: #export (- param input) (-> Ratio Ratio Ratio) (normalize [(n/- (n/* (get@ #denominator input) (get@ #numerator param)) @@ -59,16 +59,16 @@ (n/* (get@ #denominator param) (get@ #denominator input))])) -(def: #export (r/% param input) +(def: #export (% param input) (-> Ratio Ratio Ratio) (let [quot (n// (n/* (get@ #denominator input) (get@ #numerator param)) (n/* (get@ #denominator param) (get@ #numerator input)))] - (r/- (update@ #numerator (n/* quot) param) - input))) + (- (update@ #numerator (n/* quot) param) + input))) -(def: #export (r/= param input) +(def: #export (= param input) (-> Ratio Ratio Bool) (and (n/= (get@ #numerator param) (get@ #numerator input)) @@ -83,10 +83,10 @@ (n/* (get@ #denominator param) (get@ #numerator input)))))] - [r/< n/<] - [r/<= n/<=] - [r/> n/>] - [r/>= n/>=] + [< n/<] + [<= n/<=] + [> n/>] + [>= n/>=] ) (do-template [<name> <comp>] @@ -96,26 +96,26 @@ right left))] - [r/min r/<] - [r/max r/>] + [min <] + [max >] ) (struct: #export _ (Eq Ratio) - (def: = r/=)) + (def: = ..=)) (struct: #export _ (order.Order Ratio) (def: eq Eq<Ratio>) - (def: < r/<) - (def: <= r/<=) - (def: > r/>) - (def: >= r/>=)) + (def: < ..<) + (def: <= ..<=) + (def: > ..>) + (def: >= ..>=)) (struct: #export _ (Number Ratio) - (def: + r/+) - (def: - r/-) - (def: * r/*) - (def: / r//) - (def: % r/%) + (def: + ..+) + (def: - ..-) + (def: * ..*) + (def: / ../) + (def: % ..%) (def: (negate (^slots [#numerator #denominator])) {#numerator denominator #denominator numerator}) diff --git a/stdlib/source/lux/data/text/format.lux b/stdlib/source/lux/data/text/format.lux index b2a1c160c..847e4ac4f 100644 --- a/stdlib/source/lux/data/text/format.lux +++ b/stdlib/source/lux/data/text/format.lux @@ -38,7 +38,7 @@ [%b Bool (:: bool.Codec<Text,Bool> encode)] [%n Nat (:: number.Codec<Text,Nat> encode)] [%i Int (:: number.Codec<Text,Int> encode)] - [%d Deg (:: number.Codec<Text,Deg> encode)] + [%r Rev (:: number.Codec<Text,Rev> encode)] [%f Frac (:: number.Codec<Text,Frac> encode)] [%t Text text.encode] [%ident Ident (:: ident.Codec<Text,Ident> encode)] diff --git a/stdlib/source/lux/lang/compiler/analysis.lux b/stdlib/source/lux/lang/compiler/analysis.lux index 235e399fb..9d35ff92c 100644 --- a/stdlib/source/lux/lang/compiler/analysis.lux +++ b/stdlib/source/lux/lang/compiler/analysis.lux @@ -1,5 +1,5 @@ (.module: - [lux #- nat int deg] + [lux #- nat int rev] (lux (data [product] [error] [text "text/" Eq<Text>] @@ -13,7 +13,7 @@ (#Bool Bool) (#Nat Nat) (#Int Int) - (#Deg Deg) + (#Rev Rev) (#Frac Frac) (#Text Text)) @@ -73,7 +73,7 @@ [bool Bool #Bool] [nat Nat #Nat] [int Int #Int] - [deg Deg #Deg] + [rev Rev #Rev] [frac Frac #Frac] [text Text #Text] ) @@ -208,7 +208,7 @@ [pattern/bool #..Bool] [pattern/nat #..Nat] [pattern/int #..Int] - [pattern/deg #..Deg] + [pattern/rev #..Rev] [pattern/frac #..Frac] [pattern/text #..Text] ) diff --git a/stdlib/source/lux/lang/compiler/analysis/case.lux b/stdlib/source/lux/lang/compiler/analysis/case.lux index 84eb23af5..233ac114a 100644 --- a/stdlib/source/lux/lang/compiler/analysis/case.lux +++ b/stdlib/source/lux/lang/compiler/analysis/case.lux @@ -160,7 +160,7 @@ ([Bool (#.Bool pattern-value) (#//.Bool pattern-value)] [Nat (#.Nat pattern-value) (#//.Nat pattern-value)] [Int (#.Int pattern-value) (#//.Int pattern-value)] - [Deg (#.Deg pattern-value) (#//.Deg pattern-value)] + [Rev (#.Rev pattern-value) (#//.Rev pattern-value)] [Frac (#.Frac pattern-value) (#//.Frac pattern-value)] [Text (#.Text pattern-value) (#//.Text pattern-value)] [Any (#.Tuple #.Nil) #//.Unit]) diff --git a/stdlib/source/lux/lang/compiler/analysis/case/coverage.lux b/stdlib/source/lux/lang/compiler/analysis/case/coverage.lux index 6a965742a..3a63a76fc 100644 --- a/stdlib/source/lux/lang/compiler/analysis/case/coverage.lux +++ b/stdlib/source/lux/lang/compiler/analysis/case/coverage.lux @@ -80,7 +80,7 @@ (operation/wrap #Partial)) ([#///.Nat] [#///.Int] - [#///.Deg] + [#///.Rev] [#///.Frac] [#///.Text]) diff --git a/stdlib/source/lux/lang/compiler/analysis/expression.lux b/stdlib/source/lux/lang/compiler/analysis/expression.lux index 879f383e8..2ef2cae5b 100644 --- a/stdlib/source/lux/lang/compiler/analysis/expression.lux +++ b/stdlib/source/lux/lang/compiler/analysis/expression.lux @@ -43,7 +43,7 @@ ([#.Bool //primitive.bool] [#.Nat //primitive.nat] [#.Int //primitive.int] - [#.Deg //primitive.deg] + [#.Rev //primitive.rev] [#.Frac //primitive.frac] [#.Text //primitive.text]) diff --git a/stdlib/source/lux/lang/compiler/analysis/primitive.lux b/stdlib/source/lux/lang/compiler/analysis/primitive.lux index 74596fba2..5f6604926 100644 --- a/stdlib/source/lux/lang/compiler/analysis/primitive.lux +++ b/stdlib/source/lux/lang/compiler/analysis/primitive.lux @@ -1,5 +1,5 @@ (.module: - [lux #- nat int deg] + [lux #- nat int rev] (lux (control monad) [macro]) [// #+ Analysis] @@ -16,7 +16,7 @@ [bool Bool #//.Bool] [nat Nat #//.Nat] [int Int #//.Int] - [deg Deg #//.Deg] + [rev Rev #//.Rev] [frac Frac #//.Frac] [text Text #//.Text] ) diff --git a/stdlib/source/lux/lang/compiler/extension/analysis/common.lux b/stdlib/source/lux/lang/compiler/extension/analysis/common.lux index 9987bd369..3cd23ed17 100644 --- a/stdlib/source/lux/lang/compiler/extension/analysis/common.lux +++ b/stdlib/source/lux/lang/compiler/extension/analysis/common.lux @@ -175,23 +175,6 @@ (///bundle.install "to-frac" (unary Int Frac)) (///bundle.install "char" (unary Int Text))))) -(def: bundle/deg - ///.Bundle - (<| (///bundle.prefix "deg") - (|> ///.fresh - (///bundle.install "+" (binary Deg Deg Deg)) - (///bundle.install "-" (binary Deg Deg Deg)) - (///bundle.install "*" (binary Deg Deg Deg)) - (///bundle.install "/" (binary Deg Deg Deg)) - (///bundle.install "%" (binary Deg Deg Deg)) - (///bundle.install "=" (binary Deg Deg Bool)) - (///bundle.install "<" (binary Deg Deg Bool)) - (///bundle.install "scale" (binary Deg Nat Deg)) - (///bundle.install "reciprocal" (binary Deg Nat Deg)) - (///bundle.install "min" (nullary Deg)) - (///bundle.install "max" (nullary Deg)) - (///bundle.install "to-frac" (unary Deg Frac))))) - (def: bundle/frac ///.Bundle (<| (///bundle.prefix "frac") @@ -206,7 +189,7 @@ (///bundle.install "smallest" (nullary Frac)) (///bundle.install "min" (nullary Frac)) (///bundle.install "max" (nullary Frac)) - (///bundle.install "to-deg" (unary Frac Deg)) + (///bundle.install "to-rev" (unary Frac Rev)) (///bundle.install "to-int" (unary Frac Int)) (///bundle.install "encode" (unary Frac Text)) (///bundle.install "decode" (unary Text (type (Maybe Frac))))))) @@ -381,7 +364,6 @@ (dict.merge bundle/lux) (dict.merge bundle/bit) (dict.merge bundle/int) - (dict.merge bundle/deg) (dict.merge bundle/frac) (dict.merge bundle/text) (dict.merge bundle/array) diff --git a/stdlib/source/lux/lang/compiler/synthesis/case.lux b/stdlib/source/lux/lang/compiler/synthesis/case.lux index c12930963..88bfd36e9 100644 --- a/stdlib/source/lux/lang/compiler/synthesis/case.lux +++ b/stdlib/source/lux/lang/compiler/synthesis/case.lux @@ -30,7 +30,7 @@ ([#///analysis.Bool #//.Bool] [#///analysis.Nat (<| #//.I64 .i64)] [#///analysis.Int (<| #//.I64 .i64)] - [#///analysis.Deg (<| #//.I64 .i64)] + [#///analysis.Rev (<| #//.I64 .i64)] [#///analysis.Frac #//.F64] [#///analysis.Text #//.Text])) diff --git a/stdlib/source/lux/lang/compiler/synthesis/expression.lux b/stdlib/source/lux/lang/compiler/synthesis/expression.lux index 52ea33805..8a07b0aea 100644 --- a/stdlib/source/lux/lang/compiler/synthesis/expression.lux +++ b/stdlib/source/lux/lang/compiler/synthesis/expression.lux @@ -34,7 +34,7 @@ (<synthesis> (.i64 value))) ([#///analysis.Nat #//.I64] [#///analysis.Int #//.I64] - [#///analysis.Deg #//.I64]))) + [#///analysis.Rev #//.I64]))) (def: #export (synthesizer extensions) (-> (Extension ///extension.Synthesis) //.Synthesizer) diff --git a/stdlib/source/lux/lang/syntax.lux b/stdlib/source/lux/lang/syntax.lux index bbbd19232..536588443 100644 --- a/stdlib/source/lux/lang/syntax.lux +++ b/stdlib/source/lux/lang/syntax.lux @@ -25,7 +25,7 @@ ## (file-name, line, column) to keep track of their provenance and ## location, which is helpful for documentation and debugging. (.module: - [lux #- nat int deg] + [lux #- nat int rev] (lux (control monad ["p" parser "p/" Monad<Parser>] ["ex" exception #+ exception:]) @@ -222,10 +222,10 @@ rich-digits^) number.Codec<Text,Int>] - [deg #.Deg + [rev #.Rev (l.seq (l.one-of ".") rich-digits^) - number.Codec<Text,Deg>] + number.Codec<Text,Rev>] ) (def: (nat-char where) @@ -605,7 +605,7 @@ (nat where) (frac where) (int where) - (deg where) + (rev where) (symbol current-module aliases where) (tag current-module aliases where) (text where) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 404d76b32..470406482 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -541,7 +541,7 @@ (wrap (:coerce Type def-value)))) (def: #export (definitions module-name) - {#.doc "The entire list of definitions in a module (including the unexported/private ones)."} + {#.doc "The entire list of definitions in a module (including the non-exported/private ones)."} (-> Text (Meta (List [Text Definition]))) (function (_ compiler) (case (get module-name (get@ #.modules compiler)) diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux index f537eedac..67da53982 100644 --- a/stdlib/source/lux/macro/code.lux +++ b/stdlib/source/lux/macro/code.lux @@ -1,5 +1,5 @@ (.module: - [lux #- nat int deg] + [lux #- nat int rev] (lux (control [equality #+ Eq]) (data bool number @@ -36,7 +36,7 @@ [bool Bool #.Bool] [nat Nat #.Nat] [int Int #.Int] - [deg Deg #.Deg] + [rev Rev #.Rev] [frac Frac #.Frac] [text Text #.Text] [symbol Ident #.Symbol] @@ -65,7 +65,7 @@ ([#.Bool Eq<Bool>] [#.Nat Eq<Nat>] [#.Int Eq<Int>] - [#.Deg Eq<Deg>] + [#.Rev Eq<Rev>] [#.Frac Eq<Frac>] [#.Text Eq<Text>] [#.Symbol Eq<Ident>] @@ -101,7 +101,7 @@ ([#.Bool Codec<Text,Bool>] [#.Nat Codec<Text,Nat>] [#.Int Codec<Text,Int>] - [#.Deg Codec<Text,Deg>] + [#.Rev Codec<Text,Rev>] [#.Frac Codec<Text,Frac>] [#.Symbol Codec<Text,Ident>]) diff --git a/stdlib/source/lux/macro/poly/equality.lux b/stdlib/source/lux/macro/poly/equality.lux index c834509d8..6eb6ce4ce 100644 --- a/stdlib/source/lux/macro/poly/equality.lux +++ b/stdlib/source/lux/macro/poly/equality.lux @@ -49,7 +49,7 @@ [(poly.like Bool) bool.Eq<Bool>] [(poly.like Nat) number.Eq<Nat>] [(poly.like Int) number.Eq<Int>] - [(poly.like Deg) number.Eq<Deg>] + [(poly.like Rev) number.Eq<Rev>] [(poly.like Frac) number.Eq<Frac>] [(poly.like Text) text.Eq<Text>])) ## Composite types diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index c26cb7327..7e787ec95 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -1,5 +1,5 @@ (.module: - [lux #- nat int deg] + [lux #- nat int rev] (lux [macro #+ with-gensyms] (control [monad #+ do Monad] [equality #+ Eq] @@ -55,7 +55,7 @@ [ bool Bool #.Bool bool.Eq<Bool> "bool"] [ nat Nat #.Nat number.Eq<Nat> "nat"] [ int Int #.Int number.Eq<Int> "int"] - [ deg Deg #.Deg number.Eq<Deg> "deg"] + [ rev Rev #.Rev number.Eq<Rev> "rev"] [ frac Frac #.Frac number.Eq<Frac> "frac"] [ text Text #.Text text.Eq<Text> "text"] [symbol Ident #.Symbol ident.Eq<Ident> "symbol"] diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux index 5994a3c22..0ca31a34c 100644 --- a/stdlib/source/lux/math.lux +++ b/stdlib/source/lux/math.lux @@ -193,7 +193,7 @@ (p/map code.bool s.bool) (p/map code.nat s.nat) (p/map code.int s.int) - (p/map code.deg s.deg) + (p/map code.rev s.rev) (p/map code.frac s.frac) (p/map code.text s.text) (p/map code.symbol s.symbol) diff --git a/stdlib/source/lux/math/logic/continuous.lux b/stdlib/source/lux/math/logic/continuous.lux index 6e9de446a..9665f2561 100644 --- a/stdlib/source/lux/math/logic/continuous.lux +++ b/stdlib/source/lux/math/logic/continuous.lux @@ -1,39 +1,39 @@ (.module: lux - (lux (data [number "Deg/" Interval<Deg>]))) + (lux (data [number "Rev/" Interval<Rev>]))) -(def: #export ~true Deg Deg/top) -(def: #export ~false Deg Deg/bottom) +(def: #export ~true Rev Rev/top) +(def: #export ~false Rev Rev/bottom) (do-template [<name> <chooser>] [(def: #export <name> - (-> Deg Deg Deg) + (-> Rev Rev Rev) <chooser>)] - [~and d/min] - [~or d/max] + [~and r/min] + [~or r/max] ) (def: #export (~not input) - (-> Deg Deg) - (d/- input ~true)) + (-> Rev Rev) + (r/- input ~true)) (def: #export (~implies consequent antecedent) - (-> Deg Deg Deg) + (-> Rev Rev Rev) (~or (~not antecedent) consequent)) (def: #export (includes~ sub super) - (-> Deg Deg Deg) + (-> Rev Rev Rev) (let [-sub (~not sub) - sum (d/+ -sub super) - no-overflow? (and (d/>= -sub sum) - (d/>= super sum))] + sum (r/+ -sub super) + no-overflow? (and (r/>= -sub sum) + (r/>= super sum))] (if no-overflow? sum ~true))) (def: #export (~= left right) - (-> Deg Deg Deg) + (-> Rev Rev Rev) (~and (~or (~not left) right) (~or left (~not right)))) diff --git a/stdlib/source/lux/math/logic/fuzzy.lux b/stdlib/source/lux/math/logic/fuzzy.lux index 7c5ee4150..57f5978f3 100644 --- a/stdlib/source/lux/math/logic/fuzzy.lux +++ b/stdlib/source/lux/math/logic/fuzzy.lux @@ -1,6 +1,6 @@ (.module: lux - (lux (data [number "Deg/" Interval<Deg>] + (lux (data [number "Rev/" Interval<Rev>] (coll [list] (set ["set" unordered #+ Set])) text/format) @@ -8,10 +8,10 @@ (// ["&" continuous])) (type: #export (Fuzzy a) - (-> a Deg)) + (-> a Rev)) (def: #export (membership elem set) - (All [a] (-> a (Fuzzy a) Deg)) + (All [a] (-> a (Fuzzy a) Rev)) (set elem)) (def: #export (union left right) @@ -49,40 +49,40 @@ (from-predicate (set.member? set))) (def: (ascending from to) - (-> Deg Deg (Fuzzy Deg)) + (-> Rev Rev (Fuzzy Rev)) (function (_ elem) - (cond (d/<= from elem) + (cond (r/<= from elem) &.~false - (d/>= to elem) + (r/>= to elem) &.~true ## in the middle... - (d// (d/- from to) - (d/- from elem))))) + (r// (r/- from to) + (r/- from elem))))) (def: (descending from to) - (-> Deg Deg (Fuzzy Deg)) + (-> Rev Rev (Fuzzy Rev)) (function (_ elem) - (cond (d/<= from elem) + (cond (r/<= from elem) &.~true - (d/>= to elem) + (r/>= to elem) &.~false ## in the middle... - (d// (d/- from to) - (d/- elem to))))) + (r// (r/- from to) + (r/- elem to))))) (def: #export (gradient from to) - (-> Deg Deg (Fuzzy Deg)) - (if (d/< to from) + (-> Rev Rev (Fuzzy Rev)) + (if (r/< to from) (ascending from to) (descending from to))) (def: #export (triangle bottom middle top) - (-> Deg Deg Deg (Fuzzy Deg)) - (case (list.sort d/< (list bottom middle top)) + (-> Rev Rev Rev (Fuzzy Rev)) + (case (list.sort r/< (list bottom middle top)) (^ (list bottom middle top)) (intersection (ascending bottom middle) (descending middle top)) @@ -91,8 +91,8 @@ (undefined))) (def: #export (trapezoid bottom middle-bottom middle-top top) - (-> Deg Deg Deg Deg (Fuzzy Deg)) - (case (list.sort d/< (list bottom middle-bottom middle-top top)) + (-> Rev Rev Rev Rev (Fuzzy Rev)) + (case (list.sort r/< (list bottom middle-bottom middle-top top)) (^ (list bottom middle-bottom middle-top top)) (intersection (ascending bottom middle-bottom) (descending middle-top top)) @@ -101,26 +101,26 @@ (undefined))) (def: #export (cut treshold set) - (All [a] (-> Deg (Fuzzy a) (Fuzzy a))) + (All [a] (-> Rev (Fuzzy a) (Fuzzy a))) (function (_ elem) (let [membership (set elem)] - (if (d/> treshold membership) - (|> membership (d/- treshold) (d/* &.~true)) + (if (r/> treshold membership) + (|> membership (r/- treshold) (r/* &.~true)) &.~false)))) (def: #export (to-predicate treshold set) - (All [a] (-> Deg (Fuzzy a) (-> a Bool))) + (All [a] (-> Rev (Fuzzy a) (-> a Bool))) (function (_ elem) - (d/> treshold (set elem)))) + (r/> treshold (set elem)))) (type: #export (Fuzzy2 a) - (-> a [Deg Deg])) + (-> a [Rev Rev])) (def: #export (type-2 lower upper) (All [a] (-> (Fuzzy a) (Fuzzy a) (Fuzzy2 a))) (function (_ elem) - (let [l-deg (lower elem) - u-deg (upper elem)] - [(d/min l-deg - u-deg) - u-deg]))) + (let [l-rev (lower elem) + u-rev (upper elem)] + [(r/min l-rev + u-rev) + u-rev]))) diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux index 28751e125..5e560ea01 100644 --- a/stdlib/source/lux/math/random.lux +++ b/stdlib/source/lux/math/random.lux @@ -1,5 +1,5 @@ (.module: {#.doc "Pseudo-random number generation (PRNG) algorithms."} - [lux #- list i64 nat int deg char] + [lux #- list i64 nat int rev char] (lux (control [functor #+ Functor] [apply #+ Apply] [monad #+ do Monad] @@ -102,9 +102,9 @@ (Random Int) (:: Monad<Random> map .int ..i64)) -(def: #export deg - (Random Deg) - (:: Monad<Random> map .deg ..i64)) +(def: #export rev + (Random Rev) + (:: Monad<Random> map .rev ..i64)) (def: #export frac (Random Frac) diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index 6061f4829..fc649eec3 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -83,7 +83,7 @@ ["Int" r.int i/= i/< i/> i/<= i/>= i/min i/max] ["Nat" r.nat n/= n/< n/> n/<= n/>= n/min n/max] ["Frac" r.frac f/= f/< f/> f/<= f/>= f/min f/max] - ["Deg" r.deg d/= d/< d/> d/<= d/>= d/min d/max] + ["Rev" r.rev r/= r/< r/> r/<= r/>= r/min r/max] ) (do-template [category rand-gen = + - * / <%> > <0> <1> <factor> <cap> <prep>] @@ -111,10 +111,10 @@ (do @ [x rand-gen] (test "" - ## Skip this test for Deg - ## because Deg division loses the last + ## Skip this test for Rev + ## because Rev division loses the last ## 32 bits of precision. - (or (text/= "Deg" category) + (or (text/= "Rev" category) (and (|> x (* <1>) (= x)) (|> x (/ <1>) (= x)))))))) @@ -128,10 +128,10 @@ #let [r (<%> y x) x' (- r x)]] (test "" - ## Skip this test for Deg - ## because Deg division loses the last + ## Skip this test for Rev + ## because Rev division loses the last ## 32 bits of precision. - (or (text/= "Deg" category) + (or (text/= "Rev" category) (or (> x' y) (|> x' (/ y) (* y) (= x')))) ))))] @@ -139,12 +139,12 @@ ["Nat" r.nat n/= n/+ n/- n/* n// n/% n/> +0 +1 +1_000_000 (n/% +1_000) id] ["Int" r.int i/= i/+ i/- i/* i// i/% i/> 0 1 1_000_000 (i/% 1_000) id] ["Frac" r.frac f/= f/+ f/- f/* f// f/% f/> 0.0 1.0 1_000_000.0 id math.floor] - ["Deg" r.deg d/= d/+ d/- d/* d// d/% d/> .0 (.deg -1) (.deg -1) id id] + ["Rev" r.rev r/= r/+ r/- r/* r// r/% r/> .0 (.rev -1) (.rev -1) id id] ) -(def: frac-deg - (r.Random Deg) - (|> r.deg +(def: frac-rev + (r.Random Rev) + (|> r.rev (:: r.Functor<Random> map (|>> (bit.left-shift +11) (bit.right-shift +11))))) (do-template [category rand-gen -> <- = <cap>] @@ -160,7 +160,7 @@ ["Nat->Int" r.nat .int .nat n/= (n/% +1_000_000)] ["Int->Frac" r.int int-to-frac frac-to-int i/= (i/% 1_000_000)] ["Frac->Int" r.frac frac-to-int int-to-frac f/= math.floor] - ["Deg->Frac" frac-deg deg-to-frac frac-to-deg d/= id] + ["Rev->Frac" frac-rev rev-to-frac frac-to-rev r/= id] ) (context: "Simple macros and constructs" diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux index e6692fb3d..9f3d94a2e 100644 --- a/stdlib/test/test/lux/data/number.lux +++ b/stdlib/test/test/lux/data/number.lux @@ -22,8 +22,8 @@ ["Nat" r.nat Eq<Nat> Order<Nat>] ["Int" r.int Eq<Int> Order<Int>] + ["Rev" r.rev Eq<Rev> Order<Rev>] ["Frac" r.frac Eq<Frac> Order<Frac>] - ["Deg" r.deg Eq<Deg> Order<Deg>] ) (do-template [category rand-gen <Number> <Order>] @@ -39,14 +39,14 @@ (not (= x (negate x)))) (= x (negate (negate x))) ## There is loss of precision when multiplying - (or (Text/= "Deg" category) + (or (Text/= "Rev" category) (= x (* (signum x) (abs x)))))))))] - ## ["Nat" r.nat Number<Nat>] + ["Nat" r.nat Number<Nat> Order<Nat>] ["Int" r.int Number<Int> Order<Int>] + ["Rev" r.rev Number<Rev> Order<Rev>] ["Frac" r.frac Number<Frac> Order<Frac>] - ["Deg" r.deg Number<Deg> Order<Deg>] ) (do-template [category rand-gen <Enum> <Number> <Order>] @@ -84,8 +84,8 @@ ["Nat" r.nat Number<Nat> Order<Nat> Interval<Nat> (function (_ _) true)] ["Int" r.int Number<Int> Order<Int> Interval<Int> (function (_ _) true)] ## Both min and max values will be positive (thus, greater than zero) + ["Rev" r.rev Number<Rev> Order<Rev> Interval<Rev> (function (_ _) true)] ["Frac" r.frac Number<Frac> Order<Frac> Interval<Frac> (f/> 0.0)] - ["Deg" r.deg Number<Deg> Order<Deg> Interval<Deg> (function (_ _) true)] ) (do-template [category rand-gen <Number> <Order> <Monoid> <cap> <test>] @@ -109,14 +109,14 @@ ["Int/Mul" r.int Number<Int> Order<Int> Mul@Monoid<Int> (i/% 1000) (function (_ _) true)] ["Int/Min" r.int Number<Int> Order<Int> Min@Monoid<Int> (i/% 1000) (function (_ _) true)] ["Int/Max" r.int Number<Int> Order<Int> Max@Monoid<Int> (i/% 1000) (function (_ _) true)] + ["Rev/Add" r.rev Number<Rev> Order<Rev> Add@Monoid<Rev> (r/% .125) (function (_ _) true)] + ["Rev/Mul" r.rev Number<Rev> Order<Rev> Mul@Monoid<Rev> (r/% .125) (function (_ _) true)] + ["Rev/Min" r.rev Number<Rev> Order<Rev> Min@Monoid<Rev> (r/% .125) (function (_ _) true)] + ["Rev/Max" r.rev Number<Rev> Order<Rev> Max@Monoid<Rev> (r/% .125) (function (_ _) true)] ["Frac/Add" r.frac Number<Frac> Order<Frac> Add@Monoid<Frac> (f/% 1000.0) (f/> 0.0)] ["Frac/Mul" r.frac Number<Frac> Order<Frac> Mul@Monoid<Frac> (f/% 1000.0) (f/> 0.0)] ["Frac/Min" r.frac Number<Frac> Order<Frac> Min@Monoid<Frac> (f/% 1000.0) (f/> 0.0)] ["Frac/Max" r.frac Number<Frac> Order<Frac> Max@Monoid<Frac> (f/% 1000.0) (f/> 0.0)] - ["Deg/Add" r.deg Number<Deg> Order<Deg> Add@Monoid<Deg> (d/% .125) (function (_ _) true)] - ## ["Deg/Mul" r.deg Number<Deg> Order<Deg> Mul@Monoid<Deg> (d/% .125) (function (_ _) true)] - ["Deg/Min" r.deg Number<Deg> Order<Deg> Min@Monoid<Deg> (d/% .125) (function (_ _) true)] - ["Deg/Max" r.deg Number<Deg> Order<Deg> Max@Monoid<Deg> (d/% .125) (function (_ _) true)] ) (do-template [<category> <rand-gen> <Eq> <Codec>] @@ -144,10 +144,10 @@ ["Int/Decimal" r.int Eq<Int> Codec<Text,Int>] ["Int/Hex" r.int Eq<Int> Hex@Codec<Text,Int>] - ["Deg/Binary" r.deg Eq<Deg> Binary@Codec<Text,Deg>] - ["Deg/Octal" r.deg Eq<Deg> Octal@Codec<Text,Deg>] - ["Deg/Decimal" r.deg Eq<Deg> Codec<Text,Deg>] - ["Deg/Hex" r.deg Eq<Deg> Hex@Codec<Text,Deg>] + ["Rev/Binary" r.rev Eq<Rev> Binary@Codec<Text,Rev>] + ["Rev/Octal" r.rev Eq<Rev> Octal@Codec<Text,Rev>] + ["Rev/Decimal" r.rev Eq<Rev> Codec<Text,Rev>] + ["Rev/Hex" r.rev Eq<Rev> Hex@Codec<Text,Rev>] ["Frac/Binary" r.frac Eq<Frac> Binary@Codec<Text,Frac>] ["Frac/Octal" r.frac Eq<Frac> Octal@Codec<Text,Frac>] @@ -169,15 +169,15 @@ (test "Binary." (and (n/= (bin "+11001001") (bin "+11_00_10_01")) (i/= (bin "11001001") (bin "11_00_10_01")) - (d/= (bin ".11001001") (bin ".11_00_10_01")) + (r/= (bin ".11001001") (bin ".11_00_10_01")) (f/= (bin "1100.1001") (bin "11_00.10_01")))) (test "Octal." (and (n/= (oct "+615243") (oct "+615_243")) (i/= (oct "615243") (oct "615_243")) - (d/= (oct ".615243") (oct ".615_243")) + (r/= (oct ".615243") (oct ".615_243")) (f/= (oct "6152.43") (oct "615_2.43")))) (test "Hexadecimal." (and (n/= (hex "+deadBEEF") (hex "+dead_BEEF")) (i/= (hex "deadBEEF") (hex "dead_BEEF")) - (d/= (hex ".deadBEEF") (hex ".dead_BEEF")) + (r/= (hex ".deadBEEF") (hex ".dead_BEEF")) (f/= (hex "deadBE.EF") (hex "dead_BE.EF")))))) diff --git a/stdlib/test/test/lux/data/number/complex.lux b/stdlib/test/test/lux/data/number/complex.lux index 14ab1c76c..6219eedcc 100644 --- a/stdlib/test/test/lux/data/number/complex.lux +++ b/stdlib/test/test/lux/data/number/complex.lux @@ -62,19 +62,19 @@ ($_ seq (test "Absolute value of complex >= absolute value of any of the parts." (let [r+i (&.complex real imaginary) - abs (get@ #&.real (&.c/abs r+i))] + abs (get@ #&.real (&.abs r+i))] (and (f/>= (frac/abs real) abs) (f/>= (frac/abs imaginary) abs)))) (test "The absolute value of a complex number involving a NaN on either dimension, results in a NaN value." - (and (number.not-a-number? (get@ #&.real (&.c/abs (&.complex number.not-a-number imaginary)))) - (number.not-a-number? (get@ #&.real (&.c/abs (&.complex real number.not-a-number)))))) + (and (number.not-a-number? (get@ #&.real (&.abs (&.complex number.not-a-number imaginary)))) + (number.not-a-number? (get@ #&.real (&.abs (&.complex real number.not-a-number)))))) (test "The absolute value of a complex number involving an infinity on either dimension, results in an infinite value." - (and (f/= number.positive-infinity (get@ #&.real (&.c/abs (&.complex number.positive-infinity imaginary)))) - (f/= number.positive-infinity (get@ #&.real (&.c/abs (&.complex real number.positive-infinity)))) - (f/= number.positive-infinity (get@ #&.real (&.c/abs (&.complex number.negative-infinity imaginary)))) - (f/= number.positive-infinity (get@ #&.real (&.c/abs (&.complex real number.negative-infinity)))))) + (and (f/= number.positive-infinity (get@ #&.real (&.abs (&.complex number.positive-infinity imaginary)))) + (f/= number.positive-infinity (get@ #&.real (&.abs (&.complex real number.positive-infinity)))) + (f/= number.positive-infinity (get@ #&.real (&.abs (&.complex number.negative-infinity imaginary)))) + (f/= number.positive-infinity (get@ #&.real (&.abs (&.complex real number.negative-infinity)))))) )))) (context: "Addidion, substraction, multiplication and division" @@ -85,40 +85,40 @@ factor gen-dim] ($_ seq (test "Adding 2 complex numbers is the same as adding their parts." - (let [z (&.c/+ y x)] - (and (&.c/= z - (&.complex (f/+ (get@ #&.real y) - (get@ #&.real x)) - (f/+ (get@ #&.imaginary y) - (get@ #&.imaginary x))))))) + (let [z (&.+ y x)] + (and (&.= z + (&.complex (f/+ (get@ #&.real y) + (get@ #&.real x)) + (f/+ (get@ #&.imaginary y) + (get@ #&.imaginary x))))))) (test "Subtracting 2 complex numbers is the same as adding their parts." - (let [z (&.c/- y x)] - (and (&.c/= z - (&.complex (f/- (get@ #&.real y) - (get@ #&.real x)) - (f/- (get@ #&.imaginary y) - (get@ #&.imaginary x))))))) + (let [z (&.- y x)] + (and (&.= z + (&.complex (f/- (get@ #&.real y) + (get@ #&.real x)) + (f/- (get@ #&.imaginary y) + (get@ #&.imaginary x))))))) (test "Subtraction is the inverse of addition." - (and (|> x (&.c/+ y) (&.c/- y) (within? margin-of-error x)) - (|> x (&.c/- y) (&.c/+ y) (within? margin-of-error x)))) + (and (|> x (&.+ y) (&.- y) (within? margin-of-error x)) + (|> x (&.- y) (&.+ y) (within? margin-of-error x)))) (test "Division is the inverse of multiplication." - (|> x (&.c/* y) (&.c// y) (within? margin-of-error x))) + (|> x (&.* y) (&./ y) (within? margin-of-error x))) (test "Scalar division is the inverse of scalar multiplication." - (|> x (&.c/*' factor) (&.c//' factor) (within? margin-of-error x))) + (|> x (&.*' factor) (&./' factor) (within? margin-of-error x))) (test "If you subtract the remainder, all divisions must be exact." - (let [rem (&.c/% y x) - quotient (|> x (&.c/- rem) (&.c// y)) + (let [rem (&.% y x) + quotient (|> x (&.- rem) (&./ y)) floored (|> quotient (update@ #&.real math.floor) (update@ #&.imaginary math.floor))] (within? 0.000000000001 x - (|> quotient (&.c/* y) (&.c/+ rem))))) + (|> quotient (&.* y) (&.+ rem))))) )))) (context: "Conjugate, reciprocal, signum, negation" @@ -137,23 +137,23 @@ (|> x &.reciprocal &.reciprocal (within? margin-of-error x))) (test "x*(x^-1) = 1" - (|> x (&.c/* (&.reciprocal x)) (within? margin-of-error &.one))) + (|> x (&.* (&.reciprocal x)) (within? margin-of-error &.one))) (test "Absolute value of signum is always root2(2), 1 or 0." - (let [signum-abs (|> x &.c/signum &.c/abs (get@ #&.real))] + (let [signum-abs (|> x &.signum &.abs (get@ #&.real))] (or (f/= 0.0 signum-abs) (f/= 1.0 signum-abs) (f/= (math.pow 0.5 2.0) signum-abs)))) (test "Negation is its own inverse." - (let [there (&.c/negate x) - back-again (&.c/negate there)] - (and (not (&.c/= there x)) - (&.c/= back-again x)))) + (let [there (&.negate x) + back-again (&.negate there)] + (and (not (&.= there x)) + (&.= back-again x)))) (test "Negation doesn't change the absolute value." - (f/= (get@ #&.real (&.c/abs x)) - (get@ #&.real (&.c/abs (&.c/negate x))))) + (f/= (get@ #&.real (&.abs x)) + (get@ #&.real (&.abs (&.negate x))))) )))) (def: (trigonometric-symmetry forward backward angle) diff --git a/stdlib/test/test/lux/data/number/ratio.lux b/stdlib/test/test/lux/data/number/ratio.lux index 73e43e6c5..c96c6f5ca 100644 --- a/stdlib/test/test/lux/data/number/ratio.lux +++ b/stdlib/test/test/lux/data/number/ratio.lux @@ -28,14 +28,14 @@ sample gen-ratio] ($_ seq (test "All zeroes are the same." - (&.r/= (&.ratio +0 denom1) - (&.ratio +0 denom2))) + (&.= (&.ratio +0 denom1) + (&.ratio +0 denom2))) (test "All ratios are built normalized." (|> sample &.normalize ("lux in-module" "lux/data/number/ratio") - (&.r/= sample))) + (&.= sample))) )))) (context: "Arithmetic" @@ -43,29 +43,29 @@ (do @ [x gen-ratio y gen-ratio - #let [min (&.r/min x y) - max (&.r/max x y)]] + #let [min (&.min x y) + max (&.max x y)]] ($_ seq (test "Addition and subtraction are opposites." - (and (|> max (&.r/- min) (&.r/+ min) (&.r/= max)) - (|> max (&.r/+ min) (&.r/- min) (&.r/= max)))) + (and (|> max (&.- min) (&.+ min) (&.= max)) + (|> max (&.+ min) (&.- min) (&.= max)))) (test "Multiplication and division are opposites." - (and (|> max (&.r// min) (&.r/* min) (&.r/= max)) - (|> max (&.r/* min) (&.r// min) (&.r/= max)))) + (and (|> max (&./ min) (&.* min) (&.= max)) + (|> max (&.* min) (&./ min) (&.= max)))) (test "Modulus by a larger ratio doesn't change the value." - (|> min (&.r/% max) (&.r/= min))) + (|> min (&.% max) (&.= min))) (test "Modulus by a smaller ratio results in a value smaller than the limit." - (|> max (&.r/% min) (&.r/< min))) + (|> max (&.% min) (&.< min))) (test "Can get the remainder of a division." - (let [remainder (&.r/% min max) - multiple (&.r/- remainder max) - factor (&.r// min multiple)] + (let [remainder (&.% min max) + multiple (&.- remainder max) + factor (&./ min multiple)] (and (|> factor (get@ #&.denominator) (n/= +1)) - (|> factor (&.r/* min) (&.r/+ remainder) (&.r/= max))))) + (|> factor (&.* min) (&.+ remainder) (&.= max))))) )))) (context: "Negation, absolute value and signum" @@ -76,14 +76,14 @@ (test "Negation is it's own inverse." (let [there (&/negate sample) back-again (&/negate there)] - (and (not (&.r/= there sample)) - (&.r/= back-again sample)))) + (and (not (&.= there sample)) + (&.= back-again sample)))) (test "All ratios are already at their absolute value." - (|> sample &/abs (&.r/= sample))) + (|> sample &/abs (&.= sample))) (test "Signum is the identity." - (|> sample (&.r/* (&/signum sample)) (&.r/= sample))) + (|> sample (&.* (&/signum sample)) (&.= sample))) )))) (context: "Order" @@ -93,10 +93,10 @@ y gen-ratio] ($_ seq (test "Can compare ratios." - (and (or (&.r/<= y x) - (&.r/> y x)) - (or (&.r/>= y x) - (&.r/< y x)))) + (and (or (&.<= y x) + (&.> y x)) + (or (&.>= y x) + (&.< y x)))) )))) (context: "Codec" @@ -107,7 +107,7 @@ (test "Can encode/decode ratios." (|> sample &/encode &/decode (case> (#.Right output) - (&.r/= sample output) + (&.= sample output) _ false)))))) diff --git a/stdlib/test/test/lux/data/text/format.lux b/stdlib/test/test/lux/data/text/format.lux index 8232fe82d..ccffe2fcf 100644 --- a/stdlib/test/test/lux/data/text/format.lux +++ b/stdlib/test/test/lux/data/text/format.lux @@ -15,7 +15,7 @@ (&/= "+123" (%n +123)) (&/= "123" (%i 123)) (&/= "123.456" (%f 123.456)) - (&/= ".5" (%d .5)) + (&/= ".5" (%r .5)) (&/= "\"YOLO\"" (%t "YOLO")) (&/= "User-id: 123 -- Active: true" (format "User-id: " (%i 123) " -- Active: " (%b true))))) ))) diff --git a/stdlib/test/test/lux/lang/compiler/analysis/case.lux b/stdlib/test/test/lux/lang/compiler/analysis/case.lux index d2836558e..cbf11b164 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/case.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/case.lux @@ -61,7 +61,7 @@ (r/wrap (list (' _))))) ([#.Nat r.nat code.nat] [#.Int r.int code.int] - [#.Deg r.deg code.deg] + [#.Rev r.rev code.rev] [#.Frac r.frac code.frac] [#.Text (r.unicode +5) code.text]) diff --git a/stdlib/test/test/lux/lang/compiler/analysis/primitive.lux b/stdlib/test/test/lux/lang/compiler/analysis/primitive.lux index 0d4bffb39..6f4cd1afc 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/primitive.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/primitive.lux @@ -33,7 +33,7 @@ [Bool code.bool r.bool] [Nat code.nat r.nat] [Int code.int r.int] - [Deg code.deg r.deg] + [Rev code.rev r.rev] [Frac code.frac r.frac] [Text code.text (r.unicode +5)] ))))) @@ -80,7 +80,7 @@ ["bool" Bool #analysis.Bool r.bool code.bool] ["nat" Nat #analysis.Nat r.nat code.nat] ["int" Int #analysis.Int r.int code.int] - ["deg" Deg #analysis.Deg r.deg code.deg] + ["rev" Rev #analysis.Rev r.rev code.rev] ["frac" Frac #analysis.Frac r.frac code.frac] ["text" Text #analysis.Text (r.unicode +5) code.text] ))))))) diff --git a/stdlib/test/test/lux/lang/compiler/synthesis/primitive.lux b/stdlib/test/test/lux/lang/compiler/synthesis/primitive.lux index aa0da89ea..0fd4d58c1 100644 --- a/stdlib/test/test/lux/lang/compiler/synthesis/primitive.lux +++ b/stdlib/test/test/lux/lang/compiler/synthesis/primitive.lux @@ -23,7 +23,7 @@ r.bool r.nat r.int - r.deg + r.rev r.frac (r.unicode +5)))] (wrap (#analysisL.Primitive primitive)))) @@ -48,7 +48,7 @@ (is? valueS (.i64 valueA)) [(#//.Primitive (#//.I64 valueS)) - (#analysisL.Primitive (#analysisL.Deg valueA))] + (#analysisL.Primitive (#analysisL.Rev valueA))] (is? valueS (.i64 valueA)) [(#//.Primitive (#//.F64 valueS)) @@ -68,7 +68,7 @@ [%bool% r.bool %nat% r.nat %int% r.int - %deg% r.deg + %rev% r.rev %frac% r.frac %text% (r.unicode +5)] (`` ($_ seq @@ -87,6 +87,6 @@ ["bool" #analysisL.Bool #//.Bool %bool%] ["nat" #analysisL.Nat #//.I64 (.i64 %nat%)] ["int" #analysisL.Int #//.I64 (.i64 %int%)] - ["deg" #analysisL.Deg #//.I64 (.i64 %deg%)] + ["rev" #analysisL.Rev #//.I64 (.i64 %rev%)] ["frac" #analysisL.Frac #//.F64 %frac%] ["text" #analysisL.Text #//.Text %text%]))))))) diff --git a/stdlib/test/test/lux/lang/syntax.lux b/stdlib/test/test/lux/lang/syntax.lux index 0645bfe25..0ea9c5b9c 100644 --- a/stdlib/test/test/lux/lang/syntax.lux +++ b/stdlib/test/test/lux/lang/syntax.lux @@ -46,7 +46,7 @@ (|> r.bool (r/map code.bool)) (|> r.nat (r/map code.nat)) (|> r.int (r/map code.int)) - (|> r.deg (r/map code.deg)) + (|> r.rev (r/map code.rev)) (|> r.frac (r/map code.frac)))) textual^ (: (r.Random Code) ($_ r.either diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index ba45ff6e4..342845337 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -73,7 +73,7 @@ ["Can parse Bool syntax." true code.bool bool.Eq<Bool> s.bool] ["Can parse Nat syntax." +123 code.nat number.Eq<Nat> s.nat] ["Can parse Int syntax." 123 code.int number.Eq<Int> s.int] - ["Can parse Deg syntax." .123 code.deg number.Eq<Deg> s.deg] + ["Can parse Rev syntax." .123 code.rev number.Eq<Rev> s.rev] ["Can parse Frac syntax." 123.0 code.frac number.Eq<Frac> s.frac] ["Can parse Text syntax." "\n" code.text text.Eq<Text> s.text] ["Can parse Symbol syntax." ["yolo" "lol"] code.symbol ident.Eq<Ident> s.symbol] diff --git a/stdlib/test/test/lux/math/logic/continuous.lux b/stdlib/test/test/lux/math/logic/continuous.lux index 68ddc376c..f5eb9d1c7 100644 --- a/stdlib/test/test/lux/math/logic/continuous.lux +++ b/stdlib/test/test/lux/math/logic/continuous.lux @@ -9,25 +9,25 @@ (context: "Operations" (<| (times +100) (do @ - [left r.deg - right r.deg] + [left r.rev + right r.rev] ($_ seq (test "AND is the minimum." (let [result (&.~and left right)] - (and (d/<= left result) - (d/<= right result)))) + (and (r/<= left result) + (r/<= right result)))) (test "OR is the maximum." (let [result (&.~or left right)] - (and (d/>= left result) - (d/>= right result)))) + (and (r/>= left result) + (r/>= right result)))) (test "Double negation results in the original value." - (d/= left (&.~not (&.~not left)))) + (r/= left (&.~not (&.~not left)))) (test "Every value is equivalent to itself." - (and (d/>= left + (and (r/>= left (&.~= left left)) - (d/>= right + (r/>= right (&.~= right right)))) )))) diff --git a/stdlib/test/test/lux/math/logic/fuzzy.lux b/stdlib/test/test/lux/math/logic/fuzzy.lux index 6530fcb4a..c5c70c5a0 100644 --- a/stdlib/test/test/lux/math/logic/fuzzy.lux +++ b/stdlib/test/test/lux/math/logic/fuzzy.lux @@ -33,24 +33,24 @@ triangle (<triangle> x y z)]] ($_ seq (test "The middle value will always have maximum membership." - (d/= ~true (&.membership middle triangle))) + (r/= ~true (&.membership middle triangle))) (test "Boundary values will always have 0 membership." - (and (d/= ~false (&.membership bottom triangle)) - (d/= ~false (&.membership top triangle)))) + (and (r/= ~false (&.membership bottom triangle)) + (r/= ~false (&.membership top triangle)))) (test "Values within range, will have membership > 0." - (B/= (d/> ~false (&.membership sample triangle)) + (B/= (r/> ~false (&.membership sample triangle)) (and (<gt> bottom sample) (<lt> top sample)))) (test "Values outside of range, will have membership = 0." - (B/= (d/= ~false (&.membership sample triangle)) + (B/= (r/= ~false (&.membership sample triangle)) (or (<lte> bottom sample) (<gte> top sample)))) ))))] - ["Deg" number.Hash<Deg> r.deg &.triangle d/< d/<= d/> d/>=] + ["Rev" number.Hash<Rev> r.rev &.triangle r/< r/<= r/> r/>=] ) (do-template [<desc> <hash> <gen> <trapezoid> <lt> <lte> <gt> <gte>] @@ -74,38 +74,38 @@ trapezoid (<trapezoid> w x y z)]] ($_ seq (test "The middle values will always have maximum membership." - (and (d/= ~true (&.membership middle-bottom trapezoid)) - (d/= ~true (&.membership middle-top trapezoid)))) + (and (r/= ~true (&.membership middle-bottom trapezoid)) + (r/= ~true (&.membership middle-top trapezoid)))) (test "Boundary values will always have 0 membership." - (and (d/= ~false (&.membership bottom trapezoid)) - (d/= ~false (&.membership top trapezoid)))) + (and (r/= ~false (&.membership bottom trapezoid)) + (r/= ~false (&.membership top trapezoid)))) (test "Values within inner range will have membership = 1" - (B/= (d/= ~true (&.membership sample trapezoid)) + (B/= (r/= ~true (&.membership sample trapezoid)) (and (<gte> middle-bottom sample) (<lte> middle-top sample)))) (test "Values within range, will have membership > 0." - (B/= (d/> ~false (&.membership sample trapezoid)) + (B/= (r/> ~false (&.membership sample trapezoid)) (and (<gt> bottom sample) (<lt> top sample)))) (test "Values outside of range, will have membership = 0." - (B/= (d/= ~false (&.membership sample trapezoid)) + (B/= (r/= ~false (&.membership sample trapezoid)) (or (<lte> bottom sample) (<gte> top sample)))) ))))] - ["Deg" number.Hash<Deg> r.deg &.trapezoid d/< d/<= d/> d/>=] + ["Rev" number.Hash<Rev> r.rev &.trapezoid r/< r/<= r/> r/>=] ) (def: gen-triangle - (r.Random (&.Fuzzy Deg)) + (r.Random (&.Fuzzy Rev)) (do r.Monad<Random> - [x r.deg - y r.deg - z r.deg] + [x r.rev + y r.rev + z r.rev] (wrap (&.triangle x y z)))) (context: "Combinators" @@ -113,32 +113,32 @@ (do @ [left gen-triangle right gen-triangle - sample r.deg] + sample r.rev] ($_ seq (test "Union membership as as high as membership in any of its members." (let [combined (&.union left right) combined-membership (&.membership sample combined)] - (and (d/>= (&.membership sample left) + (and (r/>= (&.membership sample left) combined-membership) - (d/>= (&.membership sample right) + (r/>= (&.membership sample right) combined-membership)))) (test "Intersection membership as as low as membership in any of its members." (let [combined (&.intersection left right) combined-membership (&.membership sample combined)] - (and (d/<= (&.membership sample left) + (and (r/<= (&.membership sample left) combined-membership) - (d/<= (&.membership sample right) + (r/<= (&.membership sample right) combined-membership)))) (test "Complement membership is the opposite of normal membership." - (d/= (&.membership sample left) + (r/= (&.membership sample left) (~not (&.membership sample (&.complement left))))) (test "Membership in the difference will never be higher than in the set being subtracted." - (B/= (d/> (&.membership sample right) + (B/= (r/> (&.membership sample right) (&.membership sample left)) - (d/< (&.membership sample left) + (r/< (&.membership sample left) (&.membership sample (&.difference left right))))) )))) @@ -150,12 +150,12 @@ ($_ seq (test "Values that satisfy a predicate have membership = 1. Values that don't have membership = 0." - (B/= (d/= ~true (&.membership sample (&.from-predicate n/even?))) + (B/= (r/= ~true (&.membership sample (&.from-predicate n/even?))) (n/even? sample))) (test "Values that belong to a set have membership = 1. Values that don't have membership = 0." - (B/= (d/= ~true (&.membership sample (&.from-set set-10))) + (B/= (r/= ~true (&.membership sample (&.from-set set-10))) (set.member? set-10 sample))) )))) @@ -163,16 +163,16 @@ (<| (times +100) (do @ [fuzzy gen-triangle - sample r.deg - threshold r.deg + sample r.rev + threshold r.rev #let [vip-fuzzy (&.cut threshold fuzzy) member? (&.to-predicate threshold fuzzy)]] ($_ seq (test "Can increase the threshold of membership of a fuzzy set." - (B/= (d/> ~false (&.membership sample vip-fuzzy)) - (d/> threshold (&.membership sample fuzzy)))) + (B/= (r/> ~false (&.membership sample vip-fuzzy)) + (r/> threshold (&.membership sample fuzzy)))) (test "Can turn fuzzy sets into predicates through a threshold." (B/= (member? sample) - (d/> threshold (&.membership sample fuzzy)))) + (r/> threshold (&.membership sample fuzzy)))) )))) |