aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux.lux36
1 files changed, 18 insertions, 18 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux
index bfbfe0678..5abcab3dc 100644
--- a/stdlib/source/lux.lux
+++ b/stdlib/source/lux.lux
@@ -1,23 +1,17 @@
("lux def" double-quote
- ("lux check" (0 "#Text" (0))
- ("lux int char" +34))
+ ("lux int char" +34)
[["" 0 0] (10 (0))])
("lux def" new-line
- ("lux check" (0 "#Text" (0))
- ("lux int char" +10))
+ ("lux int char" +10)
[["" 0 0] (10 (0))])
("lux def" __paragraph
- ("lux check" (0 "#Text" (0))
- ("lux text concat" new-line new-line))
+ ("lux text concat" new-line new-line)
[["" 0 0] (10 (0))])
("lux def" dummy-cursor
- ("lux check" (2 (0 "#Text" (0))
- (2 (0 "#I64" (1 (0 "#Nat" (0)) (0)))
- (0 "#I64" (1 (0 "#Nat" (0)) (0)))))
- ["" 0 0])
+ ["" 0 0]
[["" 0 0]
(10 (1 [[["" 0 0] (7 ["lux" "export?"])]
[["" 0 0] (0 #1)]]
@@ -3606,13 +3600,19 @@
#None
#None))
-(def: (clip1 from text)
+(def: (clip/1 from text)
(-> Nat Text (Maybe Text))
- ("lux text clip" text from ("lux text size" text)))
+ (let [size ("lux text size" text)]
+ (if (n/<= size from)
+ (#.Some ("lux text clip" text from size))
+ #.None)))
-(def: (clip2 from to text)
+(def: (clip/2 from to text)
(-> Nat Nat Text (Maybe Text))
- ("lux text clip" text from to))
+ (if (and (n/<= to from)
+ (n/<= ("lux text size" text) to))
+ (#.Some ("lux text clip" text from to))
+ #.None))
(def: #export (error! message)
{#.doc (text$ ($_ "lux text concat"
@@ -3651,10 +3651,10 @@
(#Some idx)
(list& (default (error! "UNDEFINED")
- (clip2 0 idx input))
+ (clip/2 0 idx input))
(text/split splitter
(default (error! "UNDEFINED")
- (clip1 (n/+ 1 idx) input))))))
+ (clip/1 (n/+ 1 idx) input))))))
(def: (nth idx xs)
(All [a]
@@ -4146,7 +4146,7 @@
(def: (split at x)
(-> Nat Text (Maybe [Text Text]))
- (case [(..clip2 0 at x) (..clip1 at x)]
+ (case [(..clip/2 0 at x) (..clip/1 at x)]
[(#.Some pre) (#.Some post)]
(#.Some [pre post])
@@ -4213,7 +4213,7 @@
list/reverse
(interpose "/")
text/join)
- clean (|> module (clip1 ups) (default (error! "UNDEFINED")))
+ clean ("lux text clip" module ups ("lux text size" module))
output (case ("lux text size" clean)
0 prefix
_ ($_ text/compose prefix "/" clean))]