From febfa99c2823219c2e76d2c73b1fd8db8f6c9918 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 7 May 2018 01:37:38 -0400 Subject: - Implemented Deg functionality in pure Lux. --- .../lang/translation/ruby/procedure/common.jvm.lux | 56 ++-------------------- 1 file changed, 3 insertions(+), 53 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/ruby/procedure') diff --git a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux index e38dfff28..729acd978 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux @@ -236,9 +236,6 @@ [frac//smallest Double::MIN_VALUE ruby.float] [frac//min (f/* -1.0 Double::MAX_VALUE) ruby.float] [frac//max Double::MAX_VALUE ruby.float] - - [deg//min 0 ruby.int] - [deg//max -1 ruby.int] ) (do-template [ ] @@ -278,14 +275,6 @@ [int//div ruby./] [int//rem ruby.%] - - [deg//add ruby.+] - [deg//sub ruby.-] - [deg//mul runtimeT.deg//*] - [deg//div runtimeT.deg///] - [deg//rem ruby.-] - [deg//scale ruby.*] - [deg//reciprocal ruby./] ) (do-template [ ] @@ -312,8 +301,7 @@ [int//= ruby.=] [int//< ruby.<] - [deg//= ruby.=] - [deg//< ruby.<]) + ) (def: frac//encode Unary @@ -331,25 +319,6 @@ (ruby.return! (runtimeT.some "temp")) (ruby.return! runtimeT.none))))))) -(do-template [ ] - [(def: ( inputO) - Unary - (ruby./ inputO))] - - [int//to-frac (ruby.float 1.0)] - [deg//to-frac (ruby.send "to_f" (list) - (ruby.bit-shl (ruby.int 32) (ruby.int 1)))] - ) - -(do-template [ ] - [(def: - Unary - )] - - [frac//to-int (ruby.send "floor" (list))] - [frac//to-deg runtimeT.deg//from-frac] - ) - (def: int-procs Bundle (<| (prefix "int") @@ -363,26 +332,9 @@ (install "<" (binary int//<)) (install "min" (nullary int//min)) (install "max" (nullary int//max)) - (install "to-frac" (unary int//to-frac)) + (install "to-frac" (unary (ruby./ (ruby.float 1.0)))) (install "char" (unary (ruby.send "chr" (list))))))) -(def: deg-procs - Bundle - (<| (prefix "deg") - (|> (dict.new text.Hash) - (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") @@ -400,8 +352,7 @@ (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 frac//to-deg)) - (install "to-int" (unary frac//to-int)) + (install "to-int" (unary (ruby.send "floor" (list)))) (install "encode" (unary frac//encode)) (install "decode" (unary frac//decode))))) @@ -608,7 +559,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) -- cgit v1.2.3