From 971d5d8aceb5087d3b3aef9db45abe9bc9c7c844 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 4 Jul 2018 00:03:28 -0400 Subject: - Implemented not-a-number and both infinities in pure Lux. --- stdlib/source/lux/data/number.lux | 10 +++++----- .../source/lux/lang/compiler/extension/analysis/common.lux | 3 --- .../compiler/translation/scheme/extension/common.jvm.lux | 13 ------------- 3 files changed, 5 insertions(+), 21 deletions(-) (limited to 'stdlib/source') diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index df685c150..4ac938ac2 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -132,15 +132,15 @@ [ Min@Monoid Deg (:: Interval top) d/min] ) -(do-template [ ] +(do-template [ ] [(def: #export {#.doc } Frac - ())] + (f// 0.0 ))] - [not-a-number "lux frac not-a-number" "Not-a-number."] - [positive-infinity "lux frac positive-infinity" "Positive infinity."] - [negative-infinity "lux frac negative-infinity" "Negative infinity."] + [not-a-number 0.0 "Not a number."] + [positive-infinity 1.0 "Positive infinity."] + [negative-infinity -1.0 "Negative infinity."] ) (def: #export (not-a-number? number) diff --git a/stdlib/source/lux/lang/compiler/extension/analysis/common.lux b/stdlib/source/lux/lang/compiler/extension/analysis/common.lux index ca1c51df9..72453cac5 100644 --- a/stdlib/source/lux/lang/compiler/extension/analysis/common.lux +++ b/stdlib/source/lux/lang/compiler/extension/analysis/common.lux @@ -206,9 +206,6 @@ (///bundle.install "smallest" (nullary Frac)) (///bundle.install "min" (nullary Frac)) (///bundle.install "max" (nullary Frac)) - (///bundle.install "not-a-number" (nullary Frac)) - (///bundle.install "positive-infinity" (nullary Frac)) - (///bundle.install "negative-infinity" (nullary Frac)) (///bundle.install "to-deg" (unary Frac Deg)) (///bundle.install "to-int" (unary Frac Int)) (///bundle.install "encode" (unary Frac Text)) diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/extension/common.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/extension/common.jvm.lux index 02bdd6109..644557bdc 100644 --- a/stdlib/source/lux/lang/compiler/translation/scheme/extension/common.jvm.lux +++ b/stdlib/source/lux/lang/compiler/translation/scheme/extension/common.jvm.lux @@ -174,16 +174,6 @@ [frac//max Double::MAX_VALUE _.float] ) -(do-template [ ] - [(def: ( _) - Nullary - (_.float ))] - - [frac//not-a-number number.not-a-number] - [frac//positive-infinity number.positive-infinity] - [frac//negative-infinity number.negative-infinity] - ) - (do-template [ ] [(def: ( [subjectO paramO]) Binary @@ -252,9 +242,6 @@ (install "smallest" (nullary frac//smallest)) (install "min" (nullary frac//min)) (install "max" (nullary frac//max)) - (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-int" (unary _.exact/1)) (install "encode" (unary _.number->string/1)) (install "decode" (unary ///runtime.frac//decode))))) -- cgit v1.2.3