aboutsummaryrefslogtreecommitdiff
path: root/lux-scheme
diff options
context:
space:
mode:
authorEduardo Julian2022-08-11 04:15:07 -0400
committerEduardo Julian2022-08-11 04:15:07 -0400
commit065e8a4d8122d4616b570496915d2c0e2c78cd6b (patch)
treef2bbdc3e40b796b34026ab04c9a478d8a3f082d5 /lux-scheme
parent68d78235694c633c956bb9e8a007cad7d65370bc (diff)
Re-named the "case" macro to "when".
Diffstat (limited to 'lux-scheme')
-rw-r--r--lux-scheme/source/program.lux26
1 files changed, 13 insertions, 13 deletions
diff --git a/lux-scheme/source/program.lux b/lux-scheme/source/program.lux
index b6d06f341..ff51d1b45 100644
--- a/lux-scheme/source/program.lux
+++ b/lux-scheme/source/program.lux
@@ -139,14 +139,14 @@
(def (variant? value)
(-> Any Bit)
- (case (ffi.as [java/lang/Object] (as java/lang/Object value))
+ (when (ffi.as [java/lang/Object] (as java/lang/Object value))
{.#Some array}
... TODO: Get rid of this coercion ASAP.
(let [array (as (Array java/lang/Object) array)]
(and (n.= 3 (array.size array))
- (case (array.read! 0 array)
+ (when (array.read! 0 array)
{.#Some tag}
- (case (ffi.as java/lang/Integer tag)
+ (when (ffi.as java/lang/Integer tag)
{.#Some _}
true
@@ -182,7 +182,7 @@
(gnu/lists/Pair
[] (getCar self []) java/lang/Object
(if cdr?
- (case (array.read! 1 value)
+ (when (array.read! 1 value)
{.#Some flag_is_set}
true
@@ -248,7 +248,7 @@
(def (lux_value value)
(-> java/lang/Object java/lang/Object)
- (<| (case (ffi.as [java/lang/Object] value)
+ (<| (when (ffi.as [java/lang/Object] value)
{.#Some value}
... TODO: Get rid of the coercions below.
(if (variant? value)
@@ -275,7 +275,7 @@
(do try.monad
[tag (read (gnu/lists/Pair::getCar host_object))
#let [host_object (as gnu/lists/Pair (gnu/lists/Pair::getCdr host_object))
- flag (case (ffi.as java/lang/Boolean (gnu/lists/Pair::getCar host_object))
+ flag (when (ffi.as java/lang/Boolean (gnu/lists/Pair::getCar host_object))
{.#Some flag}
(as Bit flag)
@@ -291,7 +291,7 @@
output (is (Array Any)
(array.new size))])
(if (n.< size idx)
- (case (read (gnu/lists/FVector::getRaw (.int idx) host_object))
+ (when (read (gnu/lists/FVector::getRaw (.int idx) host_object))
{try.#Failure error}
{try.#Failure error}
@@ -302,7 +302,7 @@
(def (read host_object)
(Reader java/lang/Object)
(`` (<| (,, (with_template [<class>]
- [(case (ffi.as <class> host_object)
+ [(when (ffi.as <class> host_object)
{.#Some host_object}
{try.#Success host_object}
@@ -312,7 +312,7 @@
[gnu/mapping/Procedure] [gnu/lists/U8Vector]
))
(,, (with_template [<class> <processing>]
- [(case (ffi.as <class> host_object)
+ [(when (ffi.as <class> host_object)
{.#Some host_object}
{try.#Success (<| <processing> host_object)}
@@ -329,12 +329,12 @@
[program/VariantValue program/VariantValue::getValue]
[program/TupleValue program/TupleValue::getValue]
))
- (case (ffi.as gnu/lists/Pair host_object)
+ (when (ffi.as gnu/lists/Pair host_object)
{.#Some host_object}
(read_variant read host_object)
{.#None})
- (case (ffi.as gnu/lists/FVector host_object)
+ (when (ffi.as gnu/lists/FVector host_object)
{.#Some host_object}
(read_tuple read (as (gnu/lists/FVector java/lang/Object) host_object))
@@ -348,9 +348,9 @@
(def (expander macro inputs lux)
Expander
- (case (..ensure_macro macro)
+ (when (..ensure_macro macro)
{.#Some macro}
- (case (gnu/mapping/Procedure::apply2 (lux_value (as java/lang/Object inputs))
+ (when (gnu/mapping/Procedure::apply2 (lux_value (as java/lang/Object inputs))
(lux_value (as java/lang/Object lux))
macro)
{try.#Success output}