From 4965597043aca57a05760113f1851e96dad1eaf8 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 14 Mar 2022 06:14:57 -0400 Subject: Leaner syntax for the "for" macro. --- lux-scheme/source/program.lux | 188 +++++++++++++++++++++--------------------- 1 file changed, 94 insertions(+), 94 deletions(-) (limited to 'lux-scheme') diff --git a/lux-scheme/source/program.lux b/lux-scheme/source/program.lux index 9ffda365a..e04ba5ac2 100644 --- a/lux-scheme/source/program.lux +++ b/lux-scheme/source/program.lux @@ -1,69 +1,69 @@ (.using - [lux "*" - [program {"+" program:}] - ["[0]" ffi] - ["[0]" debug] - [abstract - ["[0]" monad {"+" do}]] - [control - [pipe {"+" exec> case> new>}] - ["[0]" maybe] - ["[0]" try {"+" Try}] - ["[0]" exception {"+" exception:}] - ["[0]" io {"+" IO io}] - [concurrency - ["[0]" promise {"+" Promise}]]] - [data - ["[0]" text ("[1]#[0]" hash) - ["%" format {"+" format}] - ["[0]" encoding]] - [collection - ["[0]" array {"+" Array}]]] - [macro - ["[0]" template]] - [math - [number {"+" hex} - ["n" nat] - ["[0]" i64]]] - [time - ["[0]" instant]] - ["[0]" world "_" - ["[0]" file] - ["[1]/[0]" program]] - ["@" target - ["_" scheme]] - [tool - [compiler - [phase {"+" Operation Phase}] - [reference - [variable {"+" Register}]] - [language - [lux - [program {"+" Program}] - [generation {"+" Context Host}] - ["[0]" synthesis] - [analysis - [macro {"+" Expander}]] - [phase - ["[0]" extension {"+" Extender Handler} - ["[1]/[0]" bundle] - ["[0]" analysis "_" - ["[1]" scheme]] - ["[0]" generation "_" - ["[1]" scheme]]] - [generation - ["[0]" reference] - ["[0]" scheme - ["[0]" runtime]]]]]] - [default - ["[0]" platform {"+" Platform}]] - [meta - ["[0]" packager "_" - ["[1]" scheme]]]]]] - [program - ["/" compositor - ["[1][0]" cli] - ["[1][0]" static]]]) + [lux "*" + [program {"+" program:}] + ["[0]" ffi] + ["[0]" debug] + [abstract + ["[0]" monad {"+" do}]] + [control + [pipe {"+" exec> case> new>}] + ["[0]" maybe] + ["[0]" try {"+" Try}] + ["[0]" exception {"+" exception:}] + ["[0]" io {"+" IO io}] + [concurrency + ["[0]" promise {"+" Promise}]]] + [data + ["[0]" text ("[1]#[0]" hash) + ["%" format {"+" format}] + ["[0]" encoding]] + [collection + ["[0]" array {"+" Array}]]] + [macro + ["[0]" template]] + [math + [number {"+" hex} + ["n" nat] + ["[0]" i64]]] + [time + ["[0]" instant]] + ["[0]" world "_" + ["[0]" file] + ["[1]/[0]" program]] + ["@" target + ["_" scheme]] + [tool + [compiler + [phase {"+" Operation Phase}] + [reference + [variable {"+" Register}]] + [language + [lux + [program {"+" Program}] + [generation {"+" Context Host}] + ["[0]" synthesis] + [analysis + [macro {"+" Expander}]] + [phase + ["[0]" extension {"+" Extender Handler} + ["[1]/[0]" bundle] + ["[0]" analysis "_" + ["[1]" scheme]] + ["[0]" generation "_" + ["[1]" scheme]]] + [generation + ["[0]" reference] + ["[0]" scheme + ["[0]" runtime]]]]]] + [default + ["[0]" platform {"+" Platform}]] + [meta + ["[0]" packager "_" + ["[1]" scheme]]]]]] + [program + ["/" compositor + ["[1][0]" cli] + ["[1][0]" static]]]) (ffi.import: java/lang/Boolean) (ffi.import: java/lang/String) @@ -414,35 +414,35 @@ (runtime.lux//program_args _.nil) _.nil)) -(for [@.old - (def: extender - Extender - ... TODO: Stop relying on coercions ASAP. - (<| (:as Extender) - (function (@self handler)) - (:as Handler) - (function (@self name phase)) - (:as Phase) - (function (@self archive parameters)) - (:as Operation) - (function (@self state)) - (:as Try) - try.trusted - (:as Try) - (do try.monad - [handler (try.from_maybe (..ensure_macro (:as Macro handler))) - output (gnu/mapping/Procedure::applyN (array.from_list (list (lux_value (:as java/lang/Object name)) - (lux_value (:as java/lang/Object phase)) - (lux_value (:as java/lang/Object archive)) - (lux_value (:as java/lang/Object parameters)) - (lux_value (:as java/lang/Object state)))) - handler)] - (..read output)))) - - @.scheme - (def: (extender handler) - Extender - (:expected handler))]) +(for @.old + (def: extender + Extender + ... TODO: Stop relying on coercions ASAP. + (<| (:as Extender) + (function (@self handler)) + (:as Handler) + (function (@self name phase)) + (:as Phase) + (function (@self archive parameters)) + (:as Operation) + (function (@self state)) + (:as Try) + try.trusted + (:as Try) + (do try.monad + [handler (try.from_maybe (..ensure_macro (:as Macro handler))) + output (gnu/mapping/Procedure::applyN (array.from_list (list (lux_value (:as java/lang/Object name)) + (lux_value (:as java/lang/Object phase)) + (lux_value (:as java/lang/Object archive)) + (lux_value (:as java/lang/Object parameters)) + (lux_value (:as java/lang/Object state)))) + handler)] + (..read output)))) + + @.scheme + (def: (extender handler) + Extender + (:expected handler))) (def: (declare_success! _) (-> Any (Promise Any)) -- cgit v1.2.3