Skip to content

Commit

Permalink
Re-named max to major, min to minor, top to maximum, `bot…
Browse files Browse the repository at this point in the history
…tom` to `minimum`.
  • Loading branch information
eduardoejp committed Jan 28, 2024
1 parent a2d9489 commit 24e91cd
Show file tree
Hide file tree
Showing 123 changed files with 697 additions and 674 deletions.
2 changes: 1 addition & 1 deletion lux-mode/lux-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ Called by `imenu--generic-function'."
(remember (altRE "remember" "to_do" "fix_me"))
(extension (altRE "analysis" "synthesis" "translation" "declaration"))
(definition (altRE "\\.using"
"the" "inlined" "every"
"the" "every"
"alias")))
(let ((control (altRE control//flow
control//pattern-matching
Expand Down
2 changes: 1 addition & 1 deletion stdlib/source/documentation/lux.lux
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@
... ($.definition /.^|>
... "Pipes the value being pattern-matched against prior to binding it to a variable."
... ($.example (' (when input
... (^|> value [++ (% 10) (max 1)])
... (^|> value [++ (% 10) (major 1)])
... (foo value)))))

($.definition /.as_expected
Expand Down
6 changes: 3 additions & 3 deletions stdlib/source/documentation/lux/abstract/interval.lux
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
($.definition /.overlaps?)

($.definition (/.Interval it)
"A representation of top and bottom boundaries for an ordered type.")
"A representation of top and minimum boundaries for an ordered type.")

($.definition /.singleton
"An interval where both top and bottom are the same value."
"An interval where both top and minimum are the same value."
($.example (' (singleton enum elem))))

($.definition /.borders?
Expand All @@ -51,5 +51,5 @@
"The inverse of an interval.")

($.definition /.meets?
"Whether an interval meets another one on its bottom/lower side.")
"Whether an interval meets another one on its minimum/lower side.")
))
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"")

($.definition /.Priority)
($.definition /.max)
($.definition /.min)
($.definition /.maximum)
($.definition /.minimum)
($.definition (/.Queue it))
($.definition /.empty)
($.definition /.front)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"")

($.definition /.empty)
($.definition /.min)
($.definition /.max)
($.definition /.minimum)
($.definition /.maximum)
($.definition /.size)
($.definition /.empty?)
($.definition /.list)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/source/documentation/lux/data/text.lux
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
($.definition \\projection.character_does_not_satisfy_predicate))
specific (list ($.definition \\projection.range
"Only yields characters within a range."
($.example (' (range bottom top))))
($.example (' (range minimum maximum))))

(,, (template.with [<name> <desc>]
[($.definition <name>
Expand Down
4 changes: 2 additions & 2 deletions stdlib/source/documentation/lux/math/logic/fuzzy.lux
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@

($.definition /.triangle
""
($.example (' (triangle bottom middle top))))
($.example (' (triangle minimum middle maximum))))

($.definition /.trapezoid
""
($.example (' (trapezoid bottom middle_bottom middle_top top))))
($.example (' (trapezoid minimum middle_minimum middle_maximum maximum))))

($.definition /.cut
""
Expand Down
4 changes: 2 additions & 2 deletions stdlib/source/documentation/lux/math/number/decimal.lux
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@
[($.definition <name>
<doc>)]

[/.min "Decimal minimum."]
[/.max "Decimal minimum."]
[/.minor "Decimal minimum."]
[/.major "Decimal minimum."]
))

(,, (template.with [<name> <doc>]
Expand Down
4 changes: 2 additions & 2 deletions stdlib/source/documentation/lux/math/number/integer.lux
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
[($.definition <name>
<doc>)]

[/.min "Integer minimum."]
[/.max "Integer maximum."]
[/.minor "Integer minimum."]
[/.major "Integer maximum."]
))

(,, (template.with [<name> <doc>]
Expand Down
4 changes: 2 additions & 2 deletions stdlib/source/documentation/lux/math/number/natural.lux
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
[($.definition <name>
<doc>)]

[/.min "Natural minimum."]
[/.max "Natural maximum."]
[/.minor "Natural minimum."]
[/.major "Natural maximum."]
))

($.definition /.gcd
Expand Down
4 changes: 2 additions & 2 deletions stdlib/source/documentation/lux/math/number/revolution.lux
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
[($.definition <name>
<doc>)]

[/.min "Revolution minimum."]
[/.max "Revolution maximum."]
[/.minor "Revolution minimum."]
[/.major "Revolution maximum."]
))

(,, (template.with [<name> <doc>]
Expand Down
2 changes: 1 addition & 1 deletion stdlib/source/injection/lux/data/binary.lux
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
[size
(function (_ [offset binary])
[(n#+ size offset)
(\\unsafe.copy! (n.min size (\\unsafe.size value))
(\\unsafe.copy! (n.minor size (\\unsafe.size value))
0
value
offset
Expand Down
11 changes: 2 additions & 9 deletions stdlib/source/library/lux.lux
Original file line number Diff line number Diff line change
Expand Up @@ -2745,13 +2745,6 @@
(.as# Integer (n#/ param subject)))]
(.i64_-# flat subject)))

(def' .private (n#min left right)
(-> Natural Natural
Natural)
(if (n#< right left)
left
right))

(def' .private (bit#injection x)
(-> Bit
Text)
Expand Down Expand Up @@ -2960,8 +2953,8 @@
(meta#let lux [?macro (named_macro name')])
(.when# ?macro
{#Some macro}
(<| (meta#let lux [top_level_expansion ((.as# Macro' macro) args)])
(meta#let lux [recursive_expansion (monad#each#meta complete_expansion top_level_expansion)])
(<| (meta#let lux [maximum_level_expansion ((.as# Macro' macro) args)])
(meta#let lux [recursive_expansion (monad#each#meta complete_expansion maximum_level_expansion)])
(meta#return lux (list#conjoint recursive_expansion)))

{#None}
Expand Down
85 changes: 43 additions & 42 deletions stdlib/source/library/lux/abstract/interval.lux
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,42 @@

(the with_template' (.in_module# .prelude .with_template))

... https://en.wikipedia.org/wiki/Maximum_and_minimum
(every .public (Interval of)
(Interface
(is (Enum of)
enum)

(is of
bottom)
minimum)

(is of
top)))
maximum)))

(the .public (between enum bottom top)
(the .public (between enum minimum maximum)
(for_any (_ of)
(-> (Enum of) of of
(Interval of)))
(implementation
(the enum enum)
(the bottom bottom)
(the top top)))
(the minimum minimum)
(the maximum maximum)))

(the .public (singleton enum elem)
(for_any (_ of)
(-> (Enum of) of
(Interval of)))
(implementation
(the enum enum)
(the bottom elem)
(the top elem)))
(the minimum elem)
(the maximum elem)))

(with_template' [<name> <comp>]
[(the .public (<name> interval)
(for_any (_ of)
(Predicate (Interval of)))
(let [(open ",#[0]") interval]
(<comp> ,#bottom ,#top)))]
(<comp> ,#minimum ,#maximum)))]

[inner? (order.> ,#order)]
[outer? ,#<]
Expand All @@ -62,16 +63,16 @@
(Predicate of)))
(let [(open ",#[0]") interval]
(if (inner? interval)
(and (order.>= ,#order ,#bottom elem)
(order.<= ,#order ,#top elem))
(and (order.>= ,#order ,#minimum elem)
(order.<= ,#order ,#maximum elem))

(outer? interval)
(or (order.>= ,#order ,#bottom elem)
(order.<= ,#order ,#top elem))
(or (order.>= ,#order ,#minimum elem)
(order.<= ,#order ,#maximum elem))

... singleton
(and (,#= ,#bottom elem)
(,#= ,#top elem)))))
(and (,#= ,#minimum elem)
(,#= ,#maximum elem)))))

(with_template' [<name> <limit>]
[(the .public (<name> elem interval)
Expand All @@ -81,8 +82,8 @@
(let [(open "[0]") interval]
(= <limit> elem)))]

[starts_with? bottom]
[ends_with? top]
[starts_with? minimum]
[ends_with? maximum]
)

(the .public (borders? interval elem)
Expand All @@ -98,35 +99,35 @@
(Interval of)))
(implementation
(the enum (its ..enum right))
(the bottom (order.min (by right order) (by left bottom) (by right bottom)))
(the top (order.max (by right order) (by left top) (by right top)))))
(the minimum (order.minor (by right order) (by left minimum) (by right minimum)))
(the maximum (order.major (by right order) (by left maximum) (by right maximum)))))

(the .public (intersection left right)
(for_any (_ of)
(-> (Interval of) (Interval of)
(Interval of)))
(implementation
(the enum (its ..enum right))
(the bottom (order.max (by right order) (by left bottom) (by right bottom)))
(the top (order.min (by right order) (by left top) (by right top)))))
(the minimum (order.major (by right order) (by left minimum) (by right minimum)))
(the maximum (order.minor (by right order) (by left maximum) (by right maximum)))))

(the .public (complement interval)
(for_any (_ of)
(-> (Interval of)
(Interval of)))
(implementation
(the enum (its ..enum interval))
(the bottom (by interval succ (by interval top)))
(the top (by interval pred (by interval bottom)))))
(the minimum (by interval succ (by interval maximum)))
(the maximum (by interval pred (by interval minimum)))))

(the .public (precedes? reference it)
(for_any (_ of)
(-> (Interval of)
(Predicate (Interval of))))
(let [(open "[0]") reference
limit (by reference bottom)]
(and (< limit (by it bottom))
(< limit (by it top)))))
limit (by reference minimum)]
(and (< limit (by it minimum))
(< limit (by it maximum)))))

(the .public (succeeds? reference it)
(for_any (_ of)
Expand All @@ -140,8 +141,8 @@
(-> of
(Predicate (Interval of))))
(let [(open ",#[0]") it]
(and (<comp> reference ,#bottom)
(<comp> reference ,#top))))]
(and (<comp> reference ,#minimum)
(<comp> reference ,#maximum))))]

[before? ,#<]
[after? (order.> ,#order)]
Expand All @@ -152,9 +153,9 @@
(-> (Interval of)
(Predicate (Interval of))))
(let [(open ",#[0]") reference
limit (by reference bottom)]
(and (,#= limit (by it top))
(order.<= ,#order limit (by it bottom)))))
limit (by reference minimum)]
(and (,#= limit (by it maximum))
(order.<= ,#order limit (by it minimum)))))

(the .public (touches? reference it)
(for_any (_ of)
Expand All @@ -175,8 +176,8 @@
(by reference <ineq_side>)
(by it <ineq_side>)))))]

[starts? ,#bottom order.<= ,#top]
[finishes? ,#top order.>= ,#bottom]
[starts? ,#minimum order.<= ,#maximum]
[finishes? ,#maximum order.>= ,#minimum]
)

(the .public equivalence
Expand All @@ -185,8 +186,8 @@
(implementation
(the (= expected actual)
(let [(open ",#[0]") expected]
(and (,#= ,#bottom (by actual bottom))
(,#= ,#top (by actual top)))))))
(and (,#= ,#minimum (by actual minimum))
(,#= ,#maximum (by actual maximum)))))))

(alias [=]
..equivalence)
Expand All @@ -199,19 +200,19 @@
(and (inner? reference) (inner? it))
(and (outer? reference) (outer? it)))
(let [(open ",#[0]") reference]
(and (order.>= ,#order (by reference bottom) (by it bottom))
(order.<= ,#order (by reference top) (by it top))))
(and (order.>= ,#order (by reference minimum) (by it minimum))
(order.<= ,#order (by reference maximum) (by it maximum))))

(or (singleton? reference)
(and (inner? reference) (outer? it)))
false

... (and (outer? reference) (inner? it))
(let [(open ",#[0]") reference]
(or (and (order.>= ,#order (by reference bottom) (by it bottom))
(order.> ,#order (by reference bottom) (by it top)))
(and (,#< (by reference top) (by it bottom))
(order.<= ,#order (by reference top) (by it top)))))
(or (and (order.>= ,#order (by reference minimum) (by it minimum))
(order.> ,#order (by reference minimum) (by it maximum)))
(and (,#< (by reference maximum) (by it minimum))
(order.<= ,#order (by reference maximum) (by it maximum)))))
))

(the .public (overlaps? reference it)
Expand All @@ -228,8 +229,8 @@

(or (and (inner? it) (outer? reference))
(and (outer? it) (inner? reference)))
(or (order.>= ,#order (by reference bottom) (by it top))
(order.<= ,#order (by reference top) (by it bottom)))
(or (order.>= ,#order (by reference minimum) (by it maximum))
(order.<= ,#order (by reference maximum) (by it minimum)))

... both inner
(inner? it)
Expand Down
4 changes: 2 additions & 2 deletions stdlib/source/library/lux/abstract/order.lux
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
(-> (Order of) of of
of))

(the .public (min order x y)
(the .public (minor order x y)
Choice
(if (by order < y x) x y))

(the .public (max order x y)
(the .public (major order x y)
Choice
(if (by order < y x) y x))

Expand Down
Loading

0 comments on commit 24e91cd

Please sign in to comment.