aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/scheme
diff options
context:
space:
mode:
authorEduardo Julian2018-05-07 01:37:38 -0400
committerEduardo Julian2018-05-07 01:37:38 -0400
commitfebfa99c2823219c2e76d2c73b1fd8db8f6c9918 (patch)
treef521419a80b04f465c6c9c5020c2063e2e555895 /new-luxc/source/luxc/lang/translation/scheme
parent3e2fddc6bfdda56dbe6947c476f85760b0811654 (diff)
- Implemented Deg functionality in pure Lux.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux41
-rw-r--r--new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux16
2 files changed, 1 insertions, 56 deletions
diff --git a/new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux
index 67ec0e95c..81d753b7b 100644
--- a/new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux
@@ -237,9 +237,6 @@
[int//min ("lux int min")]
[int//max ("lux int max")]
-
- [deg//min 0]
- [deg//max -1]
)
(do-template [<name> <frac>]
@@ -262,14 +259,6 @@
[int//mul _.*]
[int//div _.quotient]
[int//rem _.remainder]
-
- [deg//add _.+]
- [deg//sub _.-]
- [deg//rem _.-]
- [deg//scale _.*]
- [deg//mul _.*]
- [deg//div _.quotient]
- [deg//reciprocal _.quotient]
)
(do-template [<name> <op>]
@@ -296,19 +285,8 @@
[int//= _.=]
[int//< _.<]
-
- [deg//= _.=]
- [deg//< _.<]
)
-(def: deg//to-frac
- Unary
- (let [f2^32 (_.arithmetic-shift (_.int 32) (_.int 1))]
- (|>> (_.arithmetic-shift (_.int -32))
- (_.bit-and (_.int (hex "7FFFFFFFFFFFFFFF")))
- (_./ f2^32)
- (_./ (_.float 1.0)))))
-
(def: int//char (|>> (_.apply1 (_.global "integer->char"))
(_.apply1 (_.global "string"))))
@@ -328,23 +306,6 @@
(install "to-frac" (unary (|>> (_./ (_.float 1.0)))))
(install "char" (unary int//char)))))
-(def: deg-procs
- Bundle
- (<| (prefix "deg")
- (|> (dict.new text.Hash<Text>)
- (install "+" (binary deg//add))
- (install "-" (binary deg//sub))
- (install "*" (binary deg//mul))
- (install "/" (binary deg//div))
- (install "%" (binary deg//rem))
- (install "=" (binary deg//=))
- (install "<" (binary deg//<))
- (install "scale" (binary deg//scale))
- (install "reciprocal" (binary deg//reciprocal))
- (install "min" (nullary deg//min))
- (install "max" (nullary deg//max))
- (install "to-frac" (unary deg//to-frac)))))
-
(def: frac-procs
Bundle
(<| (prefix "frac")
@@ -362,7 +323,6 @@
(install "not-a-number" (nullary frac//not-a-number))
(install "positive-infinity" (nullary frac//positive-infinity))
(install "negative-infinity" (nullary frac//negative-infinity))
- (install "to-deg" (unary runtimeT.frac//to-deg))
(install "to-int" (unary (_.apply1 (_.global "exact"))))
(install "encode" (unary (_.apply1 (_.global "number->string"))))
(install "decode" (unary runtimeT.frac//decode)))))
@@ -492,7 +452,6 @@
(|> lux-procs
(dict.merge bit-procs)
(dict.merge int-procs)
- (dict.merge deg-procs)
(dict.merge frac-procs)
(dict.merge text-procs)
(dict.merge array-procs)
diff --git a/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux
index e8016eb0a..c4cd0a909 100644
--- a/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux
@@ -236,19 +236,6 @@
Runtime
(_.begin (list @@bit//logical-right-shift)))
-(def: int-high (bit//logical-right-shift (_.int 32)))
-(def: int-low (_.bit-and (_.int (hex "FFFFFFFF"))))
-
-(runtime: (frac//to-deg input)
- (with-vars [two32 shifted]
- (_.let* (list [two32 (|> (_.float 2.0) (_.expt (_.float 32.0)))]
- [shifted (|> (@@ input) (_.mod (_.float 1.0)) (_.* (@@ two32)))])
- (let [low (|> (@@ shifted) (_.mod (_.float 1.0)) (_.* (@@ two32)) as-integer)
- high (|> (@@ shifted) as-integer)]
- (|> high
- (_.arithmetic-shift (_.int 32))
- (_.+ low))))))
-
(runtime: (frac//decode input)
(with-vars [output]
(_.let (list [output ((_.apply1 (_.global "string->number")) (@@ input))])
@@ -260,8 +247,7 @@
(def: runtime//frac
Runtime
(_.begin
- (list @@frac//to-deg
- @@frac//decode)))
+ (list @@frac//decode)))
## (def: runtime//text
## Runtime