diff options
author | Eduardo Julian | 2018-07-30 23:40:48 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-07-30 23:40:48 -0400 |
commit | 748c868680683df1949f62aac274040ac5bf43da (patch) | |
tree | 67b3bd8fb402dfd00fc0ee472186fc79e6545ac7 /luxc | |
parent | 76b47564f89bac5eb6604da7bbb94aabb83d6d84 (diff) |
Now implementing math functionality in stdlib instead of the compiler.
Diffstat (limited to '')
-rw-r--r-- | luxc/src/lux/analyser/proc/common.clj | 46 | ||||
-rw-r--r-- | luxc/src/lux/compiler/jvm/proc/common.clj | 56 |
2 files changed, 0 insertions, 102 deletions
diff --git a/luxc/src/lux/analyser/proc/common.clj b/luxc/src/lux/analyser/proc/common.clj index 7b6bc6a3f..ee9ea33e8 100644 --- a/luxc/src/lux/analyser/proc/common.clj +++ b/luxc/src/lux/analyser/proc/common.clj @@ -287,40 +287,6 @@ (return (&/|list (&&/|meta exo-type _cursor (&&/$proc (&/T ["array" "size"]) (&/|list =array) (&/|list))))))))) -(do-template [<name> <proc>] - (defn <name> [analyse exo-type ?values] - (|do [:let [(&/$Cons ?input (&/$Nil)) ?values] - =input (&&/analyse-1 analyse &type/Frac ?input) - _ (&type/check exo-type &type/Frac) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["math" <proc>]) (&/|list =input) (&/|list))))))) - - ^:private analyse-math-cos "cos" - ^:private analyse-math-sin "sin" - ^:private analyse-math-tan "tan" - ^:private analyse-math-acos "acos" - ^:private analyse-math-asin "asin" - ^:private analyse-math-atan "atan" - ^:private analyse-math-exp "exp" - ^:private analyse-math-log "log" - ^:private analyse-math-ceil "ceil" - ^:private analyse-math-floor "floor" - ) - -(do-template [<name> <proc>] - (defn <name> [analyse exo-type ?values] - (|do [:let [(&/$Cons ?input (&/$Cons ?param (&/$Nil))) ?values] - =input (&&/analyse-1 analyse &type/Frac ?input) - =param (&&/analyse-1 analyse &type/Frac ?param) - _ (&type/check exo-type &type/Frac) - _cursor &/cursor] - (return (&/|list (&&/|meta exo-type _cursor - (&&/$proc (&/T ["math" <proc>]) (&/|list =input =param) (&/|list))))))) - - ^:private analyse-math-pow "pow" - ) - (defn ^:private analyse-atom-new [analyse exo-type ?values] (&type/with-var (fn [$var] @@ -463,18 +429,6 @@ "lux frac max" (analyse-frac-max analyse exo-type ?values) "lux frac int" (analyse-frac-int analyse exo-type ?values) - "lux math cos" (analyse-math-cos analyse exo-type ?values) - "lux math sin" (analyse-math-sin analyse exo-type ?values) - "lux math tan" (analyse-math-tan analyse exo-type ?values) - "lux math acos" (analyse-math-acos analyse exo-type ?values) - "lux math asin" (analyse-math-asin analyse exo-type ?values) - "lux math atan" (analyse-math-atan analyse exo-type ?values) - "lux math exp" (analyse-math-exp analyse exo-type ?values) - "lux math log" (analyse-math-log analyse exo-type ?values) - "lux math ceil" (analyse-math-ceil analyse exo-type ?values) - "lux math floor" (analyse-math-floor analyse exo-type ?values) - "lux math pow" (analyse-math-pow analyse exo-type ?values) - "lux atom new" (analyse-atom-new analyse exo-type ?values) "lux atom read" (analyse-atom-read analyse exo-type ?values) "lux atom compare-and-swap" (analyse-atom-compare-and-swap analyse exo-type ?values) diff --git a/luxc/src/lux/compiler/jvm/proc/common.clj b/luxc/src/lux/compiler/jvm/proc/common.clj index 3b490ebb6..b074e37b9 100644 --- a/luxc/src/lux/compiler/jvm/proc/common.clj +++ b/luxc/src/lux/compiler/jvm/proc/common.clj @@ -464,47 +464,6 @@ &&/wrap-long)]] (return nil))) -(do-template [<name> <method>] - (defn <name> [compile ?values special-args] - (|do [:let [(&/$Cons ?input (&/$Nil)) ?values] - ^MethodVisitor *writer* &/get-writer - _ (compile ?input) - :let [_ (doto *writer* - &&/unwrap-double - (.visitMethodInsn Opcodes/INVOKESTATIC "java/lang/Math" <method> "(D)D") - &&/wrap-double)]] - (return nil))) - - ^:private compile-math-cos "cos" - ^:private compile-math-sin "sin" - ^:private compile-math-tan "tan" - ^:private compile-math-acos "acos" - ^:private compile-math-asin "asin" - ^:private compile-math-atan "atan" - ^:private compile-math-exp "exp" - ^:private compile-math-log "log" - ^:private compile-math-ceil "ceil" - ^:private compile-math-floor "floor" - ) - -(do-template [<name> <method>] - (defn <name> [compile ?values special-args] - (|do [:let [(&/$Cons ?input (&/$Cons ?param (&/$Nil))) ?values] - ^MethodVisitor *writer* &/get-writer - _ (compile ?input) - :let [_ (doto *writer* - &&/unwrap-double)] - _ (compile ?param) - :let [_ (doto *writer* - &&/unwrap-double)] - :let [_ (doto *writer* - (.visitMethodInsn Opcodes/INVOKESTATIC "java/lang/Math" <method> "(DD)D") - &&/wrap-double)]] - (return nil))) - - ^:private compile-math-pow "pow" - ) - (defn ^:private compile-atom-new [compile ?values special-args] (|do [:let [(&/$Cons ?init (&/$Nil)) ?values] ^MethodVisitor *writer* &/get-writer @@ -675,21 +634,6 @@ "decode" (compile-frac-decode compile ?values special-args) ) - "math" - (case proc - "cos" (compile-math-cos compile ?values special-args) - "sin" (compile-math-sin compile ?values special-args) - "tan" (compile-math-tan compile ?values special-args) - "acos" (compile-math-acos compile ?values special-args) - "asin" (compile-math-asin compile ?values special-args) - "atan" (compile-math-atan compile ?values special-args) - "exp" (compile-math-exp compile ?values special-args) - "log" (compile-math-log compile ?values special-args) - "ceil" (compile-math-ceil compile ?values special-args) - "floor" (compile-math-floor compile ?values special-args) - "pow" (compile-math-pow compile ?values special-args) - ) - "box" (case proc "new" (compile-box-new compile ?values special-args) |