aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux64
1 files changed, 33 insertions, 31 deletions
diff --git a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
index ccad8ba2a..16dab0814 100644
--- a/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
+++ b/stdlib/source/library/lux/tool/compiler/language/lux/phase/generation/ruby/function.lux
@@ -1,6 +1,6 @@
(.using
[library
- [lux {"-" Variant Tuple function}
+ [lux {"-" function}
[abstract
["[0]" monad {"+" do}]]
[data
@@ -19,7 +19,7 @@
["/[1]" // "_"
["[1][0]" reference]
["//[1]" /// "_"
- [analysis {"+" Variant Tuple Environment Abstraction Application Analysis}]
+ [analysis {"+" Environment Abstraction Application Analysis}]
[synthesis {"+" Synthesis}]
["[1][0]" generation {"+" Context}]
["//[1]" /// "_"
@@ -52,12 +52,12 @@
_
[(_.set (list @self) (_.lambda {.#None}
- (|> (list.enumeration inits)
- (list#each (|>> product.left ..capture)))
- (let [@self (_.local self)]
- ($_ _.then
- (_.set (list @self) function_definition)
- (_.return @self)))))
+ [(|> (list.enumeration inits)
+ (list#each (|>> product.left ..capture)))
+ (let [@self (_.local self)]
+ ($_ _.then
+ (_.set (list @self) function_definition)
+ (_.return @self)))]))
(_.apply_lambda/* inits @self)])))
(def: input
@@ -91,29 +91,31 @@
initialize_self!
(list.indices arity))
[declaration instatiation] (with_closure closureO+ function_name
- (_.lambda {.#None} (list (_.variadic @curried))
- ($_ _.then
- (_.set (list @num_args) (_.the "length" @curried))
- (_.cond (list [(|> @num_args (_.= arityO))
- (<| (_.then initialize!)
- //loop.with_scope
- body!)]
- [(|> @num_args (_.> arityO))
- (let [slice (.function (_ from to)
- (_.array_range from to @curried))
- arity_args (_.splat (slice (_.int +0) limitO))
- output_func_args (_.splat (slice arityO @num_args))]
- (_.return (|> @self
- (_.apply_lambda/* (list arity_args))
- (_.apply_lambda/* (list output_func_args)))))])
- ... (|> @num_args (_.< arityO))
- (let [@missing (_.local "missing")]
- (_.return (_.lambda {.#None} (list (_.variadic @missing))
- (_.return (|> @self
- (_.apply_lambda/* (list (_.splat (|> (_.array (list))
- (_.do "concat" (list @curried) {.#None})
- (_.do "concat" (list @missing) {.#None})))))))))))
- )))]
+ (_.lambda {.#None}
+ [(list (_.variadic @curried))
+ ($_ _.then
+ (_.set (list @num_args) (_.the "length" @curried))
+ (<| (_.if (|> @num_args (_.= arityO))
+ (<| (_.then initialize!)
+ //loop.with_scope
+ body!))
+ (_.if (|> @num_args (_.> arityO))
+ (let [slice (.function (_ from to)
+ (_.array_range from to @curried))
+ arity_args (_.splat (slice (_.int +0) limitO))
+ output_func_args (_.splat (slice arityO @num_args))]
+ (_.return (|> @self
+ (_.apply_lambda/* (list arity_args))
+ (_.apply_lambda/* (list output_func_args))))))
+ ... (|> @num_args (_.< arityO))
+ (let [@missing (_.local "missing")]
+ (_.return (_.lambda {.#None}
+ [(list (_.variadic @missing))
+ (_.return (|> @self
+ (_.apply_lambda/* (list (_.splat (|> (_.array (list))
+ (_.do "concat" (list @curried) {.#None})
+ (_.do "concat" (list @missing) {.#None})))))))]))))
+ )]))]
_ (/////generation.execute! declaration)
_ (/////generation.save! function_artifact {.#None} declaration)]
(in instatiation)))