aboutsummaryrefslogtreecommitdiff
path: root/lux-python
diff options
context:
space:
mode:
Diffstat (limited to 'lux-python')
-rw-r--r--lux-python/source/program.lux70
1 files changed, 35 insertions, 35 deletions
diff --git a/lux-python/source/program.lux b/lux-python/source/program.lux
index ecb78d6f4..11720f39f 100644
--- a/lux-python/source/program.lux
+++ b/lux-python/source/program.lux
@@ -146,7 +146,7 @@
(type: Translator
(-> org/python/core/PyObject (Try Any)))
- (def: (read_tuple read host_object)
+ (def (read_tuple read host_object)
(-> Translator Translator)
(let [size (|> host_object org/python/core/PyObject::__len__ ffi.of_int .nat)]
(loop (again [idx 0
@@ -170,7 +170,7 @@
(exception.report
"Object" (ffi.of_string (java/lang/Object::toString object))))
- (def: (read_variant read host_object)
+ (def (read_variant read host_object)
(-> Translator Translator)
(case [(org/python/core/PyObject::__getitem__ (ffi.as_int +0) host_object)
(org/python/core/PyObject::__getitem__ (ffi.as_int +1) host_object)
@@ -206,7 +206,7 @@
"[1]::[0]"
(value [] java/lang/Object))
- (def: (read host_object)
+ (def (read host_object)
Translator
(`` (<| (~~ (with_template [<class> <processing>]
[(case (ffi.as <class> (as <class> host_object))
@@ -243,16 +243,16 @@
... (exception.except ..unknown_kind_of_object [(as java/lang/Object host_object)])
{try.#Success host_object})))
- (def: (function/? arity)
+ (def (function/? arity)
(-> Nat Code)
(` (.-> (~+ (list.repeated arity (` .Any))) .Any)))
- (def: (inputs/? arity)
+ (def (inputs/? arity)
(-> Nat (List Text))
(|> (list.indices arity)
(list#each (|>> %.nat (format "input/")))))
- (def: (pseudo_function to_host it)
+ (def (pseudo_function to_host it)
(-> (-> Any org/python/core/PyObject) Any org/python/core/PyObject)
(<| (as org/python/core/PyObject)
(ffi.object [] org/python/core/PyObject [LuxValue]
@@ -293,14 +293,14 @@
(~~ (static.literals code.local (inputs/? 8))))
input/+))))))))))))
- (def: object_class
+ (def object_class
(java/lang/Class java/lang/Object)
(java/lang/Object::getClass (java/lang/Object::new)))
(import library/lux/Function
"[1]::[0]")
- (def: (to_host|array to_host it)
+ (def (to_host|array to_host it)
(-> (-> Any org/python/core/PyObject) Any org/python/core/PyObject)
(as org/python/core/PyObject
(ffi.object [] org/python/core/PyArray [LuxValue]
@@ -335,7 +335,7 @@
(pyget "super" [index']))))
)))
- (def: (to_host it)
+ (def (to_host it)
(-> Any org/python/core/PyObject)
(`` (<| (~~ (with_template [<jvm> <python>]
[(case (ffi.as <jvm> (as java/lang/Object it))
@@ -358,7 +358,7 @@
@.jvm (these <jvm>)
@.python (these)))
-(with_expansions [<jvm> (these (def: (call_macro inputs lux macro)
+(with_expansions [<jvm> (these (def (call_macro inputs lux macro)
(-> (List Code) Lux org/python/core/PyFunction (Try (Try [Lux (List Code)])))
(|> macro
(org/python/core/PyFunction::__call__ (|> (ffi.array org/python/core/PyObject 2)
@@ -368,7 +368,7 @@
try#conjoint
as_expected))
- (def: python_function!
+ (def python_function!
(-> Any (Maybe org/python/core/PyFunction))
(|>> (as java/lang/Object)
(ffi.as org/python/core/PyFunction)))
@@ -378,7 +378,7 @@
"Object" (ffi.of_string (java/lang/Object::toString object))
"Class" (ffi.of_string (java/lang/Class::getName (java/lang/Object::getClass object)))))
- (def: (expander macro inputs lux)
+ (def (expander macro inputs lux)
Expander
(case (python_function! macro)
{.#Some macro}
@@ -398,11 +398,11 @@
@.jvm (these <jvm>)
@.python
- (def: (expander macro inputs lux)
+ (def (expander macro inputs lux)
Expander
{try.#Success ((as Macro' macro) inputs lux)})))
-(with_expansions [<jvm> (def: host
+(with_expansions [<jvm> (def host
(IO (Host (_.Expression Any) (_.Statement Any)))
(io (let [interpreter (org/python/util/PythonInterpreter::new)
evaluate! (is (-> unit.ID [(Maybe unit.ID) (_.Expression Any)] (Try Any))
@@ -422,9 +422,9 @@
output)))]
(is (Host (_.Expression Any) (_.Statement Any))
(implementation
- (def: evaluate evaluate!)
- (def: execute execute!)
- (def: (define context custom [@def input])
+ (def evaluate evaluate!)
+ (def execute execute!)
+ (def (define context custom [@def input])
(let [global (maybe.else (reference.artifact context)
custom)
@global (_.var global)]
@@ -434,16 +434,16 @@
value (evaluate! context [@def @global])]
(in [global value definition]))))
- (def: (ingest context content)
+ (def (ingest context content)
(|> content
(at utf8.codec decoded)
try.trusted
(as (_.Statement Any))))
- (def: (re_learn context custom content)
+ (def (re_learn context custom content)
(execute! content))
- (def: (re_load context custom content)
+ (def (re_load context custom content)
(do try.monad
[_ (execute! content)]
(evaluate! context [{.#None} (_.var (reference.artifact context))]))))))))]
@@ -454,7 +454,7 @@
(these (import (dict [] ffi.Dict))
(import (eval [ffi.String ffi.Dict] "try" Any))
- (def: host
+ (def host
(IO (Host (_.Expression Any) (_.Statement Any)))
(io (is (Host (_.Expression Any) (_.Statement Any))
(let [globals (..dict [])
@@ -474,22 +474,22 @@
value (evaluate! context @global)]
(in [global value definition])))))]
(implementation
- (def: evaluate! evaluate!)
- (def: execute! execute!)
- (def: define! define!)
+ (def evaluate! evaluate!)
+ (def execute! execute!)
+ (def define! define!)
- (def: (ingest context content)
+ (def (ingest context content)
(|> content (at utf8.codec decoded) try.trusted (as (_.Statement Any))))
- (def: (re_learn context content)
+ (def (re_learn context content)
(execute! content))
- (def: (re_load context content)
+ (def (re_load context content)
(do try.monad
[_ (execute! content)]
(evaluate! context (_.var (reference.artifact context)))))))))))))
-(with_expansions [<jvm> (these (def: (extender phase_wrapper)
+(with_expansions [<jvm> (these (def (extender phase_wrapper)
(-> phase.Wrapper Extender)
... TODO: Stop relying on coercions ASAP.
(<| (as Extender)
@@ -517,17 +517,17 @@
@.jvm (these <jvm>)
@.python
- (def: (extender phase_wrapper handler)
+ (def (extender phase_wrapper handler)
(-> phase.Wrapper Extender)
(as_expected handler))))
-(def: (phase_wrapper archive)
+(def (phase_wrapper archive)
(-> Archive (runtime.Operation phase.Wrapper))
(|> (..pseudo_function ..to_host)
(as phase.Wrapper)
phase#in))
-(def: platform
+(def platform
(IO (Platform Register (_.Expression Any) (_.Statement Any)))
(do io.monad
[host ..host]
@@ -538,7 +538,7 @@
platform.#phase_wrapper ..phase_wrapper
platform.#write (|>> _.code (at utf8.codec encoded))])))
-(def: (program context program)
+(def (program context program)
(Program (_.Expression Any) (_.Statement Any))
(all _.then
(_.import "sys")
@@ -551,11 +551,11 @@
_.none)
program)))))
-(def: (declare_success! _)
+(def (declare_success! _)
(-> Any (Async Any))
(async.future (at world/program.default exit +0)))
-(def: (scope body)
+(def (scope body)
(-> (_.Statement Any) (_.Statement Any))
(let [@program (_.var "lux_program")
; _.statement
@@ -572,7 +572,7 @@
(; (_.apply (list) @program))
))))
-(def: (lux_compiler it)
+(def (lux_compiler it)
(-> Any platform.Custom)
(undefined))