aboutsummaryrefslogtreecommitdiff
path: root/lux-python
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-python
parent68d78235694c633c956bb9e8a007cad7d65370bc (diff)
Re-named the "case" macro to "when".
Diffstat (limited to 'lux-python')
-rw-r--r--lux-python/source/program.lux42
1 files changed, 21 insertions, 21 deletions
diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux
index 8cbe4e0e4..389e8251a 100644
--- a/lux-python/source/program.lux
+++ b/lux-python/source/program.lux
@@ -154,9 +154,9 @@
output (as (Array Any)
(array.empty size))])
(if (n.< size idx)
- (case (org/python/core/PyObject::__getitem__ (ffi.as_int (.int idx)) host_object)
+ (when (org/python/core/PyObject::__getitem__ (ffi.as_int (.int idx)) host_object)
{try.#Success value}
- (case (read value)
+ (when (read value)
{try.#Success lux_value}
(again (++ idx) (array.has! idx lux_value output))
@@ -173,7 +173,7 @@
(def (read_variant read host_object)
(-> Translator Translator)
- (case [(org/python/core/PyObject::__getitem__ (ffi.as_int +0) host_object)
+ (when [(org/python/core/PyObject::__getitem__ (ffi.as_int +0) host_object)
(org/python/core/PyObject::__getitem__ (ffi.as_int +1) host_object)
(org/python/core/PyObject::__getitem__ (ffi.as_int +2) host_object)]
(^.or [{try.#Failure try} _ _]
@@ -188,7 +188,7 @@
{try.#Success value}])
{try.#Success [tag
(is Any
- (case (ffi.as org/python/core/PyNone
+ (when (ffi.as org/python/core/PyNone
(as java/lang/Object flag))
{.#Some _}
(as Any (ffi.null))
@@ -210,7 +210,7 @@
(def (read host_object)
Translator
(`` (<| (,, (with_template [<class> <processing>]
- [(case (ffi.as <class> (as <class> host_object))
+ [(when (ffi.as <class> (as <class> host_object))
{.#Some host_object}
{try.#Success (`` (|> host_object (,, (template.spliced <processing>))))}
@@ -232,7 +232,7 @@
[[java/lang/Object] [(|>)]]
))
(,, (with_template [<class> <processing>]
- [(case (ffi.as <class> host_object)
+ [(when (ffi.as <class> host_object)
{.#Some host_object}
(<| <processing> (as org/python/core/PyObject) host_object)
@@ -270,7 +270,7 @@
[inputs (monad.each ! ..read (array.list {.#None} inputs))]
(in (loop (again [it it
inputs inputs])
- (`` (`` (case inputs
+ (`` (`` (when inputs
(list)
(as org/python/core/PyObject self)
@@ -316,19 +316,19 @@
(org/python/core/PyArray
[] (pyget self [index' int])
org/python/core/PyObject
- (case (|> it
+ (when (|> it
(as (Array Any))
(array.item (|> index' ffi.int_to_long (as Nat))))
{.#None}
(ffi.super [index'] self)
{.#Some it}
- (<| (case (ffi.as [java/lang/Object] (as java/lang/Object it))
+ (<| (when (ffi.as [java/lang/Object] (as java/lang/Object it))
{.#Some it}
(to_host it)
{.#None})
- (case (ffi.as library/lux/Function (as java/lang/Object it))
+ (when (ffi.as library/lux/Function (as java/lang/Object it))
{.#Some it}
(pseudo_function to_host it)
@@ -339,7 +339,7 @@
(def (to_host it)
(-> Any org/python/core/PyObject)
(`` (<| (,, (with_template [<jvm> <python>]
- [(case (ffi.as <jvm> (as java/lang/Object it))
+ [(when (ffi.as <jvm> (as java/lang/Object it))
{.#Some it}
(as org/python/core/PyObject
(<python> [it]))
@@ -381,9 +381,9 @@
(def (expander macro inputs lux)
Expander
- (case (python_function! macro)
+ (when (python_function! macro)
{.#Some macro}
- (case (..call_macro inputs lux macro)
+ (when (..call_macro inputs lux macro)
{try.#Success output}
(|> output
(as org/python/core/PyObject)
@@ -413,7 +413,7 @@
(..read output))))
execute! (is (-> (_.Statement Any) (Try Any))
(function (execute! input)
- (case (org/python/util/PythonInterpreter::exec (ffi.as_string (_.code input)) interpreter)
+ (when (org/python/util/PythonInterpreter::exec (ffi.as_string (_.code input)) interpreter)
{try.#Failure error}
(if (text.contains? "maximum recursion depth exceeded" error)
(execute! input)
@@ -544,13 +544,13 @@
(all _.then
(_.import "sys")
(_.when (_.= (_.string "__main__") (_.var "__name__"))
- (_.statement (_.apply (list (|> (_.var "sys") (_.the "argv")
- ... The first entry in the list will be the program.py file itself
- ... so, it must be removed so only the program's arguments are left.
- (_.slice_from (_.int +1))
- runtime.lux::program_args)
- _.none)
- program)))))
+ (_.statement (_.apply (list (|> (_.var "sys") (_.the "argv")
+ ... The first entry in the list will be the program.py file itself
+ ... so, it must be removed so only the program's arguments are left.
+ (_.slice_from (_.int +1))
+ runtime.lux::program_args)
+ _.none)
+ program)))))
(def (declare_success! _)
(-> Any (Async Any))