diff options
author | Eduardo Julian | 2019-04-17 19:27:25 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-04-17 19:27:25 -0400 |
commit | 797e49a906d850d28d94986c127a8e432ea89e40 (patch) | |
tree | 3d1758d42a7612cdb0a167eb680cb3f8718a7c29 /stdlib/source | |
parent | c501d1357241df39573893d9b6dbcf44a22f4554 (diff) |
Order for names.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/name.lux | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/stdlib/source/lux/data/name.lux b/stdlib/source/lux/data/name.lux index b54988169..3ad96cd84 100644 --- a/stdlib/source/lux/data/name.lux +++ b/stdlib/source/lux/data/name.lux @@ -3,6 +3,7 @@ [abstract [monoid (#+)] [equivalence (#+ Equivalence)] + [order (#+ Order)] [codec (#+ Codec)] hash] [data @@ -25,6 +26,24 @@ (and (text@= xmodule ymodule) (text@= xname yname)))) +(def: (name@< [moduleP shortP] [moduleS shortS]) + (-> Name Name Bit) + (if (text@= moduleP moduleS) + (:: text.order < shortP shortS) + (:: text.order < moduleP moduleS))) + +(structure: #export order (Order Name) + (def: &equivalence ..equivalence) + (def: < name@<) + (def: (<= parameter subject) + (or (:: ..equivalence = parameter subject) + (name@< parameter subject))) + (def: (> parameter subject) + (name@< subject parameter)) + (def: (>= parameter subject) + (or (:: ..equivalence = subject parameter) + (name@< subject parameter)))) + (structure: #export codec (Codec Text Name) (def: (encode [module short]) (case module |