Skip to content

Commit

Permalink
Moved some modules to new locations.
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed Jul 2, 2024
1 parent 433acf4 commit 7670491
Show file tree
Hide file tree
Showing 87 changed files with 676 additions and 677 deletions.
2 changes: 1 addition & 1 deletion lux-js/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@
... Note: I have to call "eval" this way
... in order to avoid a quirk of calling eval in Node
... when the code is running under "use strict";.
(try (let [return (.js_apply# (function.identity (.js_constant# "eval")) [code])]
(try (let [return (.js_of# (function.identity (.js_constant# "eval")) [code])]
(if (.js_object_null?# return)
{.#None}
{.#Some return}))))
Expand Down
16 changes: 8 additions & 8 deletions lux-jvm/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,30 @@
(java/lang/Class java/lang/Object)
(ffi.class_for java/lang/Object))

(the _apply2_args
(the _of2_args
(Array (java/lang/Class java/lang/Object))
(ffi.array (java/lang/Class java/lang/Object)
[_object_class _object_class]))

(the _apply4_args
(the _of4_args
(Array (java/lang/Class java/lang/Object))
(ffi.array (java/lang/Class java/lang/Object)
[_object_class _object_class _object_class _object_class]))

(the .public (expander macro inputs lux)
Expander
(do try.monad
[apply_method (|> macro
(as (-> Macro java/lang/Object))
(java/lang/Object::getClass [])
(java/lang/Class::getMethod [(ffi.as_string "apply") _apply2_args]))]
[of_method (|> macro
(as (-> Macro java/lang/Object))
(java/lang/Object::getClass [])
(java/lang/Class::getMethod [(ffi.as_string "apply") _of2_args]))]
(as (-> (Try java/lang/Object) (Try (Try [analysis.State (List @type.Code)])))
(java/lang/reflect/Method::invoke
[(as (-> Macro java/lang/Object) macro)
(ffi.array java/lang/Object
[(as (-> (List Code) java/lang/Object) inputs)
(as (-> Lux java/lang/Object) lux)])]
apply_method))))
of_method))))

(the phase_wrapper
phase.Wrapper
Expand Down Expand Up @@ -135,7 +135,7 @@
[method (|> handler
(as (-> Any java/lang/Object))
(java/lang/Object::getClass [])
(java/lang/Class::getMethod [(ffi.as_string "apply") _apply4_args]))]
(java/lang/Class::getMethod [(ffi.as_string "apply") _of4_args]))]
(java/lang/reflect/Method::invoke
[(as (-> Any java/lang/Object) handler)
(ffi.array java/lang/Object
Expand Down
62 changes: 31 additions & 31 deletions lux-lua/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
(list $input (` (..read (, $input))))))
list#conjoint))

(the (apply/* to_host self parameters abstraction)
(the (of/* to_host self parameters abstraction)
(-> (-> Any java/lang/Object) net/sandius/rembulan/runtime/LuaFunction (List java/lang/Object) Any Any)
(<| try.trusted
(do [! try.monad]
Expand Down Expand Up @@ -344,10 +344,10 @@
void
"throws" [net/sandius/rembulan/runtime/ResolvedControlThrowable]
(<| (..return %)
(apply/* to_host
(ffi.is net/sandius/rembulan/runtime/LuaFunction self)
(list (,, (static.literals function.identity (..input/* <arity>))))
lux_function)))]
(of/* to_host
(ffi.is net/sandius/rembulan/runtime/LuaFunction self)
(list (,, (static.literals function.identity (..input/* <arity>))))
lux_function)))]

[1]
[2]
Expand All @@ -362,10 +362,10 @@
void
"throws" [net/sandius/rembulan/runtime/ResolvedControlThrowable]
(<| (..return %)
(apply/* to_host
(ffi.is net/sandius/rembulan/runtime/LuaFunction self)
(list.of_array {.#None} input/*)
lux_function)))
(of/* to_host
(ffi.is net/sandius/rembulan/runtime/LuaFunction self)
(list.of_array {.#None} input/*)
lux_function)))
)))))

(ffi.import library/lux/Function
Expand Down Expand Up @@ -519,8 +519,8 @@
$b3 (_.var "b3")
$b4 (_.var "b4")
table/insert (function (_ in/0 in/1)
(_.apply (list in/0 in/1)
(_.var "table.insert")))]
(_.of (list in/0 in/1)
(_.var "table.insert")))]
(_.function (_.var "utf8.char") (list $var_args)
(all _.then
(_.local/1 $buffer (_.array (list)))
Expand All @@ -535,30 +535,30 @@
(<| (_.if (_.< (!integer "80") $v)
... Single-byte sequence
(_.; (|> (_.var "string.char")
(_.apply (list $v))
(_.of (list $v))
(table/insert $buffer))))
(_.if (_.< (!integer "800") $v)
... Two-byte sequence
(_.; (|> (_.var "string.char")
(_.apply (list (!&|< "C0" "1F" +6 $v)
(!&| "80" "3F" $v)))
(_.of (list (!&|< "C0" "1F" +6 $v)
(!&| "80" "3F" $v)))
(table/insert $buffer))))
(_.if (_.< (!integer "10000") $v)
... Three-byte sequence
(_.; (|> (_.var "string.char")
(_.apply (list (!&|< "E0" "0F" +12 $v)
(!&|< "80" "3F" +6 $v)
(!&| "80" "3F" $v)))
(_.of (list (!&|< "E0" "0F" +12 $v)
(!&|< "80" "3F" +6 $v)
(!&| "80" "3F" $v)))
(table/insert $buffer))))
... Four-byte sequence
(_.; (|> (_.var "string.char")
(_.apply (list (!&|< "F0" "07" +18 $v)
(!&|< "80" "3F" +12 $v)
(!&|< "80" "3F" +6 $v)
(!&| "80" "3F" $v)))
(_.of (list (!&|< "F0" "07" +18 $v)
(!&|< "80" "3F" +12 $v)
(!&|< "80" "3F" +6 $v)
(!&| "80" "3F" $v)))
(table/insert $buffer))))
))
(_.return (_.apply (list $buffer (_.string "")) (_.var "table.concat")))
(_.return (_.of (list $buffer (_.string "")) (_.var "table.concat")))
))))

... (the rembulan//str_rel_to_abs
Expand All @@ -578,7 +578,7 @@
... (_.> (_.length $string) $v))
... (_.; (_.error/2 (_.string "bad index to string (out of range)") (_.int +3))))
... (_.set (list (_.nth $k $args)) $v)))
... (_.return (_.apply (list $args) (_.var "table.unpack")))
... (_.return (_.of (list $args) (_.var "table.unpack")))
... ))))

... (the rembulan//decode
Expand All @@ -590,7 +590,7 @@
... $end (_.var "_end")]
... (<| (_.local_function $decode (list $string $start))
... (all _.then
... (_.set (list $start) (_.apply (list $string (_.or (_.int +1) $start)) $str_rel_to_abs))
... (_.set (list $start) (_.of (list $string (_.or (_.int +1) $start)) $str_rel_to_abs))
... (_.local/1 $b1 (_.do "byte" (list $start $start) $string))
... (<| (_.if (_.< (!integer "80") $b1)
... ... Single-byte sequence
Expand Down Expand Up @@ -630,7 +630,7 @@
... (_.if (_.> (_.length $string) $i)
... (_.return _.nil)
... (all _.then
... (_.let (list $start $end) (_.apply (list $string $i) $decode))
... (_.let (list $start $end) (_.of (list $string $i) $decode))
... (_.if (_.not $start)
... (_.; (_.error/2 (_.string "invalid UTF-8 code") (_.int +2)))
... (all _.then
Expand All @@ -649,11 +649,11 @@
... $size (_.var "size")]
... (_.function (_.var "utf8.len") (list $string $start $end)
... (all _.then
... (_.set (list $start $end) (_.apply (list $string (_.or (_.int +1) $start) (_.or (_.int -1) $end)) $str_rel_to_abs))
... (_.set (list $start $end) (_.of (list $string (_.or (_.int +1) $start) (_.or (_.int -1) $end)) $str_rel_to_abs))
... (_.local/1 $size (_.int +0))
... (_.repeat (_.>= $end $seq_end)
... (all _.then
... (_.let (list $seq_start $seq_end) (_.apply (list $string $start) $decode))
... (_.let (list $seq_start $seq_end) (_.of (list $string $start) $decode))
... (_.if (_.not $seq_start)
... ... Hit an invalid sequence!
... (_.return (_.multi (list (_.boolean false) $start)))
Expand Down Expand Up @@ -745,7 +745,7 @@
(function (_ code)
(do try.monad
[lua_function (..load (_.code code))]
(let [output ("lua apply" lua_function)]
(let [output ("lua of" lua_function)]
{try.#Success (if ("lua object nil?" output)
[]
output)}))))]
Expand Down Expand Up @@ -858,9 +858,9 @@
(the (lux_program context program)
(Program _.Expression _.Statement)
(let [$program (_.var (reference.artifact context))]
(_.; (_.apply (list (runtime.lux//program_args (_.var "arg"))
runtime.unit)
program))))
(_.; (_.of (list (runtime.lux//program_args (_.var "arg"))
runtime.unit)
program))))

(the (declare_success! _)
(-> Any (Future Any))
Expand Down
6 changes: 3 additions & 3 deletions lux-php/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,9 @@

(the (program context program)
(Program _.Expression _.Statement)
(_.; (_.apply/2 program
[(runtime.lux//program_args _.command_line_arguments)
_.null])))
(_.; (_.of/2 program
[(runtime.lux//program_args _.command_line_arguments)
_.null])))

(for .jvm
(the extender
Expand Down
16 changes: 8 additions & 8 deletions lux-python/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -551,13 +551,13 @@
(all _.then
(_.import "sys")
(_.when (_.= (_.string "__main__") (_.var "__name__"))
(_.; (_.apply (list (|> (_.var "sys") (_.its "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)))))
(_.; (_.of (list (|> (_.var "sys") (_.its "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)))))

(the (declare_success! _)
(-> Any (Future Any))
Expand All @@ -576,7 +576,7 @@
(_.; (_.do "setrecursionlimit" (list new_limit) $sys))
... (_.; (_.do "stack_size" (list current_limit) $threading))
(_.def @program (list) body)
(_.; (_.apply (list) @program))
(_.; (_.of (list) @program))
))))

(the (lux_compiler it)
Expand Down
4 changes: 2 additions & 2 deletions lux-r/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@

(the (program context program)
(Program _.Expression _.Expression)
(_.apply/2 program [(runtime.lux::program_args (_.commandArgs/0 [])) _.null]))
(_.of/2 program [(runtime.lux::program_args (_.commandArgs/0 [])) _.null]))

(for .jvm
(the extender
Expand Down Expand Up @@ -603,7 +603,7 @@
(let [$program (_.var "lux_program")]
(all _.then
(_.set! $program (_.function (stack) body))
(_.apply/0 $program [])
(_.of/0 $program [])
)))

(`` (the _
Expand Down
10 changes: 5 additions & 5 deletions lux-ruby/source/program.lux
Original file line number Diff line number Diff line change
Expand Up @@ -1015,11 +1015,11 @@
(list (_.string (_.code _.command_line_arguments)))
{.#None}
(is _.CVar (_.manual "Object")))]
(_.; (_.apply_lambda (list (runtime.lux//program_args (_.? normal_runtime?
_.command_line_arguments
(_.array (list))))
_.nil)
program))))
(_.; (_.of_lambda (list (runtime.lux//program_args (_.? normal_runtime?
_.command_line_arguments
(_.array (list))))
_.nil)
program))))

(the (declare_success! _)
(-> Any (Future Any))
Expand Down
6 changes: 3 additions & 3 deletions stdlib/source/documentation/lux/control/concatenative.lux
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@
else (=> ,,,0 ,,,1)]
,,,0 [Bit then else] ,,,1)))))

($.definition /.apply
($.definition /.of
"A generator for functions that turn arity N functions into arity N concatenative functions."
($.example (' (is (=> [Natural] [Natural])
((apply 1) ++)))))
((of 1) ++)))))

(,, (template.with [<arity>]
[(expansion.let [<name> (template.name [/._] ["apply_" <arity>])
[(expansion.let [<name> (template.name [/._] ["of_" <arity>])
<doc> (template.text ["Lift a function of arity " <arity>
" into a concatenative function of arity " <arity> "."])]
($.definition <name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
($.definition /.var)
($.definition /.at)
($.definition /.its)
($.definition /.apply)
($.definition /.of)
($.definition /.do)
($.definition /.object)
($.definition /.,)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
($.definition /.item)
($.definition /.its)
($.definition /.length)
($.definition /.apply)
($.definition /.of)
($.definition /.do)
($.definition /.concat)
($.definition /.or)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
($.definition /.slice)
($.definition /.slice_from)
($.definition /.dict)
($.definition /.apply)
($.definition /.of)
($.definition /.splat_poly)
($.definition /.splat_keyword)
($.definition /.its)
Expand Down
4 changes: 2 additions & 2 deletions stdlib/source/documentation/lux/meta/compiler/target/ruby.lux
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
($.definition /.array_range)
($.definition /.array)
($.definition /.hash)
($.definition /.apply)
($.definition /.apply_lambda)
($.definition /.of)
($.definition /.of_lambda)
($.definition /.its)
($.definition /.item)
($.definition /.?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
(pure [@ {analysis.#Extension (/.translation extension)
(list (analysis.text @ name))}])))]))

(the js::apply
(the js::of
(-> Text Handler)
(custom
[(all <>.and ?list.any (<code>.tuple (<>.some ?list.any)))
Expand Down Expand Up @@ -151,7 +151,7 @@
with_object_extensions

(/.with "js_constant#" js::constant)
(/.with "js_apply#" js::apply)
(/.with "js_of#" js::of)
(/.with "js_type_of#" js::type_of)
(/.with "js_function#" js::function)
))
Loading

0 comments on commit 7670491

Please sign in to comment.