From 39325bb36c6f6459c861ef12f9e99b9e66b52594 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 8 Jul 2022 17:18:30 -0400 Subject: Moved "lux/static" to "lux/meta/static". --- stdlib/source/library/lux/ffi/export.js.lux | 2 +- stdlib/source/library/lux/ffi/export.lua.lux | 2 +- stdlib/source/library/lux/ffi/export.py.lux | 2 +- stdlib/source/library/lux/ffi/export.rb.lux | 4 +- stdlib/source/library/lux/math.lux | 2 +- .../library/lux/meta/compiler/default/platform.lux | 2 +- .../lux/meta/compiler/meta/packager/scheme.lux | 2 +- stdlib/source/library/lux/meta/static.lux | 140 +++++++++++++++++++++ stdlib/source/library/lux/static.lux | 140 --------------------- 9 files changed, 148 insertions(+), 148 deletions(-) create mode 100644 stdlib/source/library/lux/meta/static.lux delete mode 100644 stdlib/source/library/lux/static.lux (limited to 'stdlib/source/library') diff --git a/stdlib/source/library/lux/ffi/export.js.lux b/stdlib/source/library/lux/ffi/export.js.lux index a661027ab..bb725ed0c 100644 --- a/stdlib/source/library/lux/ffi/export.js.lux +++ b/stdlib/source/library/lux/ffi/export.js.lux @@ -2,7 +2,6 @@ [library [lux (.except) [extension (.only declaration)] - ["[0]" static] [abstract ["[0]" monad (.only do)]] [control @@ -16,6 +15,7 @@ [math ["[0]" random]] ["[0]" meta (.only) + ["[0]" static] ["[0]" code (.only) ["<[1]>" \\parser]] ["[0]" macro (.only) diff --git a/stdlib/source/library/lux/ffi/export.lua.lux b/stdlib/source/library/lux/ffi/export.lua.lux index b485934c5..c59c410ae 100644 --- a/stdlib/source/library/lux/ffi/export.lua.lux +++ b/stdlib/source/library/lux/ffi/export.lua.lux @@ -2,7 +2,6 @@ [library [lux (.except) [extension (.only declaration)] - ["[0]" static] [abstract ["[0]" monad (.only do)]] [control @@ -16,6 +15,7 @@ [math ["[0]" random]] ["[0]" meta (.only) + ["[0]" static] ["[0]" code (.only) ["<[1]>" \\parser]] ["[0]" macro (.only) diff --git a/stdlib/source/library/lux/ffi/export.py.lux b/stdlib/source/library/lux/ffi/export.py.lux index 63cc2c471..70c5fc591 100644 --- a/stdlib/source/library/lux/ffi/export.py.lux +++ b/stdlib/source/library/lux/ffi/export.py.lux @@ -2,7 +2,6 @@ [library [lux (.except) [extension (.only declaration)] - ["[0]" static] [abstract ["[0]" monad (.only do)]] [control @@ -16,6 +15,7 @@ [math ["[0]" random]] ["[0]" meta (.only) + ["[0]" static] ["[0]" code (.only) ["<[1]>" \\parser]] ["[0]" macro (.only) diff --git a/stdlib/source/library/lux/ffi/export.rb.lux b/stdlib/source/library/lux/ffi/export.rb.lux index aa1ade262..df3ab6f85 100644 --- a/stdlib/source/library/lux/ffi/export.rb.lux +++ b/stdlib/source/library/lux/ffi/export.rb.lux @@ -2,8 +2,6 @@ [library [lux (.except global) [extension (.only declaration)] - ["[0]" static] - ["[0]" type] [abstract ["[0]" monad (.only do)]] [control @@ -18,6 +16,8 @@ [math ["[0]" random]] ["[0]" meta (.only) + ["[0]" static] + ["[0]" type] ["[0]" code (.only) ["<[1]>" \\parser]] ["[0]" macro (.only) diff --git a/stdlib/source/library/lux/math.lux b/stdlib/source/library/lux/math.lux index 794bef35d..bbad785af 100644 --- a/stdlib/source/library/lux/math.lux +++ b/stdlib/source/library/lux/math.lux @@ -2,7 +2,6 @@ [library [lux (.except) [extension (.only analysis)] - ["[0]" static] [abstract ["[0]" monad (.only do)]] [control @@ -16,6 +15,7 @@ ["[0]" list (.use "[1]#[0]" mix)]]] [meta ["@" target] + ["[0]" static] ["[0]" code ["<[1]>" \\parser]] [macro diff --git a/stdlib/source/library/lux/meta/compiler/default/platform.lux b/stdlib/source/library/lux/meta/compiler/default/platform.lux index d8c301eb7..436d6bac3 100644 --- a/stdlib/source/library/lux/meta/compiler/default/platform.lux +++ b/stdlib/source/library/lux/meta/compiler/default/platform.lux @@ -2,7 +2,6 @@ [library [lux (.except) ["[0]" debug] - ["[0]" static] [abstract ["[0]" monad (.only Monad do)]] [control @@ -27,6 +26,7 @@ ["[0]" list (.use "[1]#[0]" monoid functor mix)]]] ["[0]" meta (.only) ["@" target] + ["[0]" static] ["[0]" configuration (.only Configuration)] [type (.only sharing) ["[0]" check]]] diff --git a/stdlib/source/library/lux/meta/compiler/meta/packager/scheme.lux b/stdlib/source/library/lux/meta/compiler/meta/packager/scheme.lux index 0b14e378f..29dfd6b81 100644 --- a/stdlib/source/library/lux/meta/compiler/meta/packager/scheme.lux +++ b/stdlib/source/library/lux/meta/compiler/meta/packager/scheme.lux @@ -1,7 +1,6 @@ (.require [library [lux (.except Module) - [type (.only sharing)] [abstract ["[0]" monad (.only do)]] [control @@ -21,6 +20,7 @@ [format ["[0]" tar]]] [meta + [type (.only sharing)] [target ["_" scheme]]] [world diff --git a/stdlib/source/library/lux/meta/static.lux b/stdlib/source/library/lux/meta/static.lux new file mode 100644 index 000000000..617ce7cdb --- /dev/null +++ b/stdlib/source/library/lux/meta/static.lux @@ -0,0 +1,140 @@ +(.require + [library + [lux (.except nat int rev if cond) + [abstract + [monad (.only do)]] + [control + ["<>" parser]] + [data + [collection + ["[0]" list (.use "[1]#[0]" functor mix)]]] + [math + [number (.only hex)] + ["[0]" random (.only Random)]] + ["[0]" meta (.use "[1]#[0]" functor) + ["[0]" code (.only) + ["<[1]>" \\parser]] + [macro + [syntax (.only syntax)]]]]]) + +(with_template [ ] + [(def .public + (syntax (_ [expression .any]) + (at meta.monad each + (|>> (as ) list) + (meta.eval expression))))] + + [bit .Bit code.bit] + [nat .Nat code.nat] + [int .Int code.int] + [rev .Rev code.rev] + [frac .Frac code.frac] + [text .Text code.text] + ) + +(def pcg_32_magic_inc + Nat + (hex "FEDCBA9876543210")) + +(with_expansions [ (Ex (_ a) + [(-> a Code) + a])] + (def .public literal + (syntax (_ [format .any + expression .any]) + (do meta.monad + [pair (meta.eval (.type_literal ) + (` [(, format) (, expression)])) + .let [[format expression] (as pair)]] + (in (list (format expression))))))) + +(with_expansions [ (Ex (_ a) + [(-> a Code) + (List a)])] + (def .public literals + (syntax (_ [format .any + expression .any]) + (do meta.monad + [pair (meta.eval (.type_literal ) + (` [(, format) (, expression)])) + .let [[format expression] (as pair)]] + (in (list#each format expression)))))) + +(def .public seed + (syntax (_ []) + (meta#each (|>> code.nat list) meta.seed))) + +(with_template [ ] + [(def .public + (syntax (_ []) + (do meta.monad + [seed meta.seed + .let [[_ result] (random.result (random.pcg_32 [..pcg_32_magic_inc seed]) + )]] + (in (list ( result))))))] + + [random_bit random.bit code.bit] + [random_nat random.nat code.nat] + [random_int random.int code.int] + [random_rev random.rev code.rev] + [random_frac random.frac code.frac] + ) + +(with_expansions [ (Ex (_ a) + [(-> a Code) + (Random a)])] + (def .public random + (syntax (_ [format .any + random .any]) + (do meta.monad + [pair (meta.eval (type_literal ) + (` [(, format) (, random)])) + .let [[format random] (as pair)] + seed meta.seed + .let [[_ result] (random.result (random.pcg_32 [..pcg_32_magic_inc seed]) + random)]] + (in (list (format result))))))) + +(with_expansions [ (Ex (_ a) + [(-> a Code) + (Random (List a))])] + (def .public randoms + (syntax (_ [format .any + random .any]) + (do meta.monad + [pair (meta.eval (type_literal ) + (` [(, format) (, random)])) + .let [[format random] (as pair)] + seed meta.seed + .let [[_ result] (random.result (random.pcg_32 [..pcg_32_magic_inc seed]) + random)]] + (in (list#each format result)))))) + +(def .public if + (syntax (_ [test .any + then .any + else .any]) + (do meta.monad + [test (meta.eval .Bit test)] + (in (list (.if (as .Bit test) + then + else)))))) + +(def .public cond + (syntax (_ [test,then/* (<>.some (<>.and .any .any)) + else .any]) + (in (list (list#mix (function (_ [test then] else) + (` (..if (, test) + (, then) + (, else)))) + else + (list.reversed test,then/*)))))) + +(def .public when + (syntax (_ [test .any + then .any]) + (do meta.monad + [test (meta.eval .Bit test)] + (in (.if (as .Bit test) + (list then) + (list)))))) diff --git a/stdlib/source/library/lux/static.lux b/stdlib/source/library/lux/static.lux deleted file mode 100644 index 617ce7cdb..000000000 --- a/stdlib/source/library/lux/static.lux +++ /dev/null @@ -1,140 +0,0 @@ -(.require - [library - [lux (.except nat int rev if cond) - [abstract - [monad (.only do)]] - [control - ["<>" parser]] - [data - [collection - ["[0]" list (.use "[1]#[0]" functor mix)]]] - [math - [number (.only hex)] - ["[0]" random (.only Random)]] - ["[0]" meta (.use "[1]#[0]" functor) - ["[0]" code (.only) - ["<[1]>" \\parser]] - [macro - [syntax (.only syntax)]]]]]) - -(with_template [ ] - [(def .public - (syntax (_ [expression .any]) - (at meta.monad each - (|>> (as ) list) - (meta.eval expression))))] - - [bit .Bit code.bit] - [nat .Nat code.nat] - [int .Int code.int] - [rev .Rev code.rev] - [frac .Frac code.frac] - [text .Text code.text] - ) - -(def pcg_32_magic_inc - Nat - (hex "FEDCBA9876543210")) - -(with_expansions [ (Ex (_ a) - [(-> a Code) - a])] - (def .public literal - (syntax (_ [format .any - expression .any]) - (do meta.monad - [pair (meta.eval (.type_literal ) - (` [(, format) (, expression)])) - .let [[format expression] (as pair)]] - (in (list (format expression))))))) - -(with_expansions [ (Ex (_ a) - [(-> a Code) - (List a)])] - (def .public literals - (syntax (_ [format .any - expression .any]) - (do meta.monad - [pair (meta.eval (.type_literal ) - (` [(, format) (, expression)])) - .let [[format expression] (as pair)]] - (in (list#each format expression)))))) - -(def .public seed - (syntax (_ []) - (meta#each (|>> code.nat list) meta.seed))) - -(with_template [ ] - [(def .public - (syntax (_ []) - (do meta.monad - [seed meta.seed - .let [[_ result] (random.result (random.pcg_32 [..pcg_32_magic_inc seed]) - )]] - (in (list ( result))))))] - - [random_bit random.bit code.bit] - [random_nat random.nat code.nat] - [random_int random.int code.int] - [random_rev random.rev code.rev] - [random_frac random.frac code.frac] - ) - -(with_expansions [ (Ex (_ a) - [(-> a Code) - (Random a)])] - (def .public random - (syntax (_ [format .any - random .any]) - (do meta.monad - [pair (meta.eval (type_literal ) - (` [(, format) (, random)])) - .let [[format random] (as pair)] - seed meta.seed - .let [[_ result] (random.result (random.pcg_32 [..pcg_32_magic_inc seed]) - random)]] - (in (list (format result))))))) - -(with_expansions [ (Ex (_ a) - [(-> a Code) - (Random (List a))])] - (def .public randoms - (syntax (_ [format .any - random .any]) - (do meta.monad - [pair (meta.eval (type_literal ) - (` [(, format) (, random)])) - .let [[format random] (as pair)] - seed meta.seed - .let [[_ result] (random.result (random.pcg_32 [..pcg_32_magic_inc seed]) - random)]] - (in (list#each format result)))))) - -(def .public if - (syntax (_ [test .any - then .any - else .any]) - (do meta.monad - [test (meta.eval .Bit test)] - (in (list (.if (as .Bit test) - then - else)))))) - -(def .public cond - (syntax (_ [test,then/* (<>.some (<>.and .any .any)) - else .any]) - (in (list (list#mix (function (_ [test then] else) - (` (..if (, test) - (, then) - (, else)))) - else - (list.reversed test,then/*)))))) - -(def .public when - (syntax (_ [test .any - then .any]) - (do meta.monad - [test (meta.eval .Bit test)] - (in (.if (as .Bit test) - (list then) - (list)))))) -- cgit v1.2.3