Skip to content

Commit

Permalink
Re-named the left and right macros in the prelude.
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed Sep 3, 2023
1 parent 6de33f8 commit 3b9cad3
Show file tree
Hide file tree
Showing 69 changed files with 1,304 additions and 1,145 deletions.
2 changes: 1 addition & 1 deletion lux-mode/lux-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ Called by `imenu--generic-function'."
(jvm-host (altRE "import" "export" "class" "interface" "object" "synchronized" "class_for"))
(alternative-format (altRE "char" "bin" "oct" "hex"))
(documentation (altRE "comment"))
(function-application (altRE "|>" "<|" "left" "right" "all"))
(function-application (altRE "|>" "<|" "all"))
(function-definition (altRE "function" "|>>" "<<|"
"program"))
(remember (altRE "remember" "to_do" "fix_me"))
Expand Down
14 changes: 1 addition & 13 deletions stdlib/source/injection/lux/data/text.lux
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@
["<[1]>" \\projection]]
[macro
["[0]" syntax]
["[0]" template]]]
[world
["[0]" time (.only)
["[0]" duration]
["[0]" date]
["[0]" day]
["[0]" month]]]]])
["[0]" template]]]]])

... https://en.wikipedia.org/wiki/Message
(the .public message
Expand All @@ -64,12 +58,6 @@
[location Location location.injection]
[code Code code.absolute]
[type Type type.absolute_injection]

[duration duration.Duration (of duration.format injection)]
[date date.Date (of date.format injection)]
[time time.Time (of time.format injection)]
[day day.Day (of day.format injection)]
[month month.Month (of month.format injection)]
)

(template.with [<name>]
Expand Down
7 changes: 4 additions & 3 deletions stdlib/source/library/lux.lux
Original file line number Diff line number Diff line change
Expand Up @@ -1698,7 +1698,8 @@
(function' [right left]
(func left right)))

(def' .public left
... https://en.wikipedia.org/wiki/Operator_associativity
(def' .public left_associative
Macro
(macro (_ tokens)
(.when# {{#Item op tokens'}
Expand All @@ -1713,7 +1714,7 @@
(failure ..wrong_syntax)}
tokens)))

(def' .public right
(def' .public right_associative
Macro
(macro (_ tokens)
(.when# {{#Item op tokens'}
Expand All @@ -1728,7 +1729,7 @@
(failure ..wrong_syntax)}
tokens)))

(def' .public all Macro ..right)
(def' .public all Macro ..right_associative)

... (every (Monad m)
... (Interface
Expand Down
3 changes: 1 addition & 2 deletions stdlib/source/library/lux/abstract/functor.lux
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

(.require
[library
[lux (.except left right
function)
[lux (.except function)
["//" algorithm]]])

(every .public (Functor !)
Expand Down
3 changes: 2 additions & 1 deletion stdlib/source/library/lux/control/aspect.lux
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
["[0]" property]]]]
["[0]" meta (.only)
[extension (.only analysis declaration)]
["[0]" binding]
["[0]" code (.only)
["?[1]" \\projection]]
["[0]" macro (.only)
Expand Down Expand Up @@ -127,7 +128,7 @@
(-> Symbol
(Meta [Bit .Global]))
(do meta.monad
[name (meta.normal name)
[name (binding.normal name)
current_module_name meta.current_module_name
lux meta.compiler_state]
(loop (again [[normal_module normal_short] name])
Expand Down
2 changes: 1 addition & 1 deletion stdlib/source/library/lux/control/concatenative.lux
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
(.require
[library
[lux (.except Alias
if loop left right)
if loop)
[abstract
["[0]" monad]]
[control
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
["[0]" dictionary (.only Dictionary)]
["[0]" list (.use "[1]#[0]" mix)]]]
["[0]" meta (.only)
["[0]" binding]
["[0]" symbol]
["[0]" type (.only)
["[0]" nominal]]
Expand Down Expand Up @@ -87,7 +88,7 @@
(do [! meta.monad]
[bindings (monad.each ! (function (_ [name value])
(do !
[name (meta.normal name)]
[name (binding.normal name)]
(in [name value])))
bindings)]
(in (list (list#mix (function (_ [name value] term)
Expand Down
1 change: 0 additions & 1 deletion stdlib/source/library/lux/control/pattern.lux
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
nat int rev
or and
is has
left right
try with when)
[abstract
[equivalence (.only Equivalence)]]
Expand Down
3 changes: 2 additions & 1 deletion stdlib/source/library/lux/control/scope/dynamic.lux
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
["[0]" dictionary (.only Dictionary)]
["[0]" list (.use "[1]#[0]" mix)]]]
["[0]" meta (.only)
["[0]" binding]
["[0]" symbol]
["[0]" code (.only)
["?[1]" \\projection]]
Expand Down Expand Up @@ -78,7 +79,7 @@
(do [! meta.monad]
[bindings (monad.each ! (function (_ [name value])
(do !
[name (meta.normal name)]
[name (binding.normal name)]
(in [name value])))
bindings)]
(in (list (list#mix (function (_ [name value] term)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/source/library/lux/data/collection/tree/zipper.lux
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

(.require
[library
[lux (.except left right)
[lux (.except)
[abstract
[functor (.only Functor)]
[comonad (.only CoMonad)]
Expand Down
2 changes: 1 addition & 1 deletion stdlib/source/library/lux/data/product.lux
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

(.require
[library
[lux (.except left right)
[lux (.except)
[abstract
[equivalence (.only Equivalence)]
[hash (.only Hash)]
Expand Down
2 changes: 1 addition & 1 deletion stdlib/source/library/lux/data/sum.lux
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

(.require
[library
[lux (.except left right)
[lux (.except)
[abstract
[equivalence (.only Equivalence)]
[hash (.only Hash)]]
Expand Down
3 changes: 2 additions & 1 deletion stdlib/source/library/lux/debug.lux
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
["n" nat]
["i" int]]]
["[0]" meta (.only)
["[0]" binding]
["[0]" code (.only)
["<[1]>" \\projection]]
[macro
Expand Down Expand Up @@ -557,7 +558,7 @@
(<>.else (list))))])
(do [! meta.monad]
[location meta.location
locals meta.locals
locals binding.locals
.let [environment (|> locals
list.together
... The list is reversed to make sure that, when building the dictionary,
Expand Down
7 changes: 4 additions & 3 deletions stdlib/source/library/lux/documentation.lux
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
[number
["n" nat]]]
["[0]" meta (.only)
["[0]" binding]
["[0]" symbol]
["[0]" label]
["[0]" type (.use "[1]#[0]" equivalence)]
Expand Down Expand Up @@ -515,7 +516,7 @@
(syntax.macro (_ [[name parameters] ..declaration])
(do meta.monad
[.let [g!module (code.text (product.left name))]
[def_type def_value] (meta.export name)
[def_type def_value] (binding.export name)
tags (meta.try
(meta.either (label.tags name)
(label.slots name)))]
Expand Down Expand Up @@ -555,7 +556,7 @@
(the alias_documentation
(syntax.macro (_ [name ..qualified_symbol])
(do meta.monad
[original (meta.alias name)]
[original (binding.alias name)]
(in (list (` (all md.then
... Name
(md.heading/4 (md.and (md.anchor (, (let [[module short] name]
Expand Down Expand Up @@ -694,7 +695,7 @@
(syntax.macro (_ [[name _] ..qualified_symbol
description <code>.any])
(do [! meta.monad]
[coverage (|> (meta.globals name)
[coverage (|> (binding.globals name)
(of ! each (|>> (list.only exported_non_default?)
(list#each product.left))))
dependees (import.all name)]
Expand Down
6 changes: 3 additions & 3 deletions stdlib/source/library/lux/documentation/remember.lux
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
(exception.the .public (must_remember [deadline today message focus])
(Exception [Date Date Text (Maybe Code)])
(exception.report
(list ["Deadline" (%.date deadline)]
["Today" (%.date today)]
(list ["Deadline" (date.as_text deadline)]
["Today" (date.as_text today)]
["Message" message]
["Code" (when focus
{.#Some focus}
Expand Down Expand Up @@ -72,7 +72,7 @@
(syntax.macro (_ [deadline ..deadline
message <code>.text
focus (<>.maybe <code>.any)])
(in (list (` (..remember (, (code.text (%.date deadline)))
(in (list (` (..remember (, (code.text (date.as_text deadline)))
(, (code.text (%.message <message> " " message)))
(,* (when focus
{.#Some focus}
Expand Down
7 changes: 4 additions & 3 deletions stdlib/source/library/lux/ffi.jvm.lux
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
[number
["n" nat]]]
["[0]" meta (.use "[1]#[0]" monad)
["[0]" binding]
["[0]" code (.only)
["<[1]>" \\projection(.only Projection)]]
[macro (.only with_symbols)
Expand Down Expand Up @@ -2008,7 +2009,7 @@
(when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
[array_type (binding.type array_name)
context meta.type_context
array_jvm_type (lux_type->jvm_type context array_type)
.let [g!extension (`` (cond (,, (template.with [<primitive> <extension>]
Expand Down Expand Up @@ -2045,7 +2046,7 @@
(when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
[array_type (binding.type array_name)
context meta.type_context
array_jvm_type (lux_type->jvm_type context array_type)
.let [g!idx (` (.|> (, idx)
Expand Down Expand Up @@ -2085,7 +2086,7 @@
(when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
[array_type (binding.type array_name)
context meta.type_context
array_jvm_type (lux_type->jvm_type context array_type)
.let [g!idx (` (.|> (, idx)
Expand Down
5 changes: 3 additions & 2 deletions stdlib/source/library/lux/ffi.old.lux
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
["[0]" array (.only Array)]
["[0]" list (.use "[1]#[0]" monad mix monoid)]]]
["[0]" meta (.only)
["[0]" binding]
["[0]" type (.use "[1]#[0]" equivalence)]
["[0]" code (.only)
["<[1]>" \\projection (.only Projection)]]
Expand Down Expand Up @@ -1720,7 +1721,7 @@
(when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
[array_type (binding.type array_name)
array_jvm_type (type_class_name array_type)]
(`` (when array_jvm_type
(,, (template.with [<type> <array_op>]
Expand Down Expand Up @@ -1751,7 +1752,7 @@
(when array
[_ {.#Symbol array_name}]
(do meta.monad
[array_type (meta.type array_name)
[array_type (binding.type array_name)
array_jvm_type (type_class_name array_type)]
(`` (when array_jvm_type
(,, (template.with [<type> <array_op>]
Expand Down
15 changes: 1 addition & 14 deletions stdlib/source/library/lux/math/random.lux
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@
["[0]" template]]]
[world
["[0]" time (.only Time)
["[0]" date (.only Date)]
["[0]" duration (.only Duration)]
["[0]" month (.only Month)]
["[0]" day (.only Day)]]]]])
["[0]" month (.only Month)]]]]])

(for .old
(every .public PRNG
Expand Down Expand Up @@ -361,17 +359,6 @@
(..either (/#in {month.#November})
(/#in {month.#December})))))))

(the .public day
(Random Day)
(let [(open "/#[0]") ..monad]
(..either (..either (/#in {day.#Sunday})
(..either (/#in {day.#Monday})
(/#in {day.#Tuesday})))
(..either (..either (/#in {day.#Wednesday})
(/#in {day.#Thursday}))
(..either (/#in {day.#Friday})
(/#in {day.#Saturday}))))))

(for .old
(the .public (value prng seed it)
(for_any (_ seed of)
Expand Down

0 comments on commit 3b9cad3

Please sign in to comment.