diff options
author | Eduardo Julian | 2018-05-06 23:27:12 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-05-06 23:27:12 -0400 |
commit | fb72b937aba7886ce204379e97aa06c327a4029f (patch) | |
tree | 20bc243f1605c5b6c37b833b8046b82eac805494 /new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux | |
parent | 0b53bcc87ad3563daedaa64306d0bbe6df01ca49 (diff) |
- Implemented Nat functionality in pure Lux.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux | 38 |
1 files changed, 0 insertions, 38 deletions
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 09259c2b9..e8016eb0a 100644 --- a/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux @@ -239,43 +239,6 @@ (def: int-high (bit//logical-right-shift (_.int 32))) (def: int-low (_.bit-and (_.int (hex "FFFFFFFF")))) -(runtime: (nat//< param subject) - (with-vars [pH sH] - (_.let (list [pH (int-high (@@ param))] - [sH (int-high (@@ subject))]) - (_.or (list (_.< (@@ pH) (@@ sH)) - (_.and (list (_.= (@@ pH) (@@ sH)) - (_.< (int-low (@@ param)) (int-low (@@ subject)))))))))) - -(runtime: (nat/// param subject) - (_.if (_.< (_.int 0) (@@ param)) - (_.if (nat//< (@@ param) (@@ subject)) - (_.int 0) - (_.int 1)) - (with-vars [quotient] - (_.let (list [quotient (|> (@@ subject) - (bit//logical-right-shift (_.int 1)) - (_.quotient (@@ param)) - (_.arithmetic-shift (_.int 1)))]) - (let [remainder (_.- (_.* (@@ param) (@@ quotient)) - (@@ subject))] - (_.if (_.not (nat//< (@@ param) remainder)) - (_.+ (_.int 1) (@@ quotient)) - (@@ quotient))))))) - -(runtime: (nat//% param subject) - (let [flat (|> (@@ subject) - (nat/// (@@ param)) - (_.* (@@ param)))] - (|> (@@ subject) (_.- flat)))) - -(def: runtime//nat - Runtime - (_.begin - (list @@nat//< - @@nat/// - @@nat//%))) - (runtime: (frac//to-deg input) (with-vars [two32 shifted] (_.let* (list [two32 (|> (_.float 2.0) (_.expt (_.float 32.0)))] @@ -405,7 +368,6 @@ runtime//lux runtime//bit runtime//adt - runtime//nat runtime//frac ## runtime//text runtime//array |