diff options
Diffstat (limited to 'stdlib/source/lux/data')
39 files changed, 283 insertions, 287 deletions
diff --git a/stdlib/source/lux/data/bit.lux b/stdlib/source/lux/data/bit.lux index ab8c24a8e..72cfc096e 100644 --- a/stdlib/source/lux/data/bit.lux +++ b/stdlib/source/lux/data/bit.lux @@ -20,7 +20,7 @@ #1 1 #0 0))) -(do-template [<name> <identity> <op>] +(template [<name> <identity> <op>] [(structure: #export <name> (Monoid Bit) (def: identity <identity>) (def: (compose x y) (<op> x y)))] diff --git a/stdlib/source/lux/data/collection/array.lux b/stdlib/source/lux/data/collection/array.lux index d135b06d9..55e0ceb2b 100644 --- a/stdlib/source/lux/data/collection/array.lux +++ b/stdlib/source/lux/data/collection/array.lux @@ -271,7 +271,7 @@ (recur (f value so-far) (inc idx))) so-far))))) -(do-template [<name> <init> <op>] +(template [<name> <init> <op>] [(def: #export (<name> predicate array) (All [a] (-> (Predicate a) (Array a) Bit)) diff --git a/stdlib/source/lux/data/collection/bits.lux b/stdlib/source/lux/data/collection/bits.lux index 93158c54c..95732fe15 100644 --- a/stdlib/source/lux/data/collection/bits.lux +++ b/stdlib/source/lux/data/collection/bits.lux @@ -54,7 +54,7 @@ (|> bits (array.read idx) (maybe.default empty-chunk)) empty-chunk)) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> index input) (-> Nat Bits Bits) (let [[chunk-index bit-index] (n//% chunk-size index)] @@ -124,7 +124,7 @@ (recur (dec size|output))) output)))))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param subject) (-> Bits Bits Bits) (case (n/max (array.size param) diff --git a/stdlib/source/lux/data/collection/dictionary.lux b/stdlib/source/lux/data/collection/dictionary.lux index 9a9663228..a9c53ea18 100644 --- a/stdlib/source/lux/data/collection/dictionary.lux +++ b/stdlib/source/lux/data/collection/dictionary.lux @@ -613,7 +613,7 @@ (new Hash<k>) kvs)) -(do-template [<name> <elem-type> <side>] +(template [<name> <elem-type> <side>] [(def: #export (<name> dict) (All [k v] (-> (Dictionary k v) (List <elem-type>))) (|> dict entries (list@map <side>)))] diff --git a/stdlib/source/lux/data/collection/dictionary/ordered.lux b/stdlib/source/lux/data/collection/dictionary/ordered.lux index e2d0f21fd..5bd957364 100644 --- a/stdlib/source/lux/data/collection/dictionary/ordered.lux +++ b/stdlib/source/lux/data/collection/dictionary/ordered.lux @@ -26,7 +26,7 @@ #left (Maybe (Node k v)) #right (Maybe (Node k v))}) -(do-template [<create> <color>] +(template [<create> <color>] [(def: (<create> key value left right) (All [k v] (-> k v (Maybe (Node k v)) (Maybe (Node k v)) (Node k v))) {#color <color> @@ -91,7 +91,7 @@ (recur (get@ #left node)) (recur (get@ #right node))))))))) -(do-template [<name> <side>] +(template [<name> <side>] [(def: #export (<name> dict) (All [k v] (-> (Dictionary k v) (Maybe v))) (case (get@ #root dict) @@ -111,7 +111,7 @@ [max #right] ) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> dict) (All [k v] (-> (Dictionary k v) Nat)) (loop [node (get@ #root dict)] @@ -127,7 +127,7 @@ [depth n/max] ) -(do-template [<name> <other-color> <self-color> <no-change>] +(template [<name> <other-color> <self-color> <no-change>] [(def: (<name> self) (All [k v] (-> (Node k v) (Node k v))) (case (get@ #color self) @@ -256,7 +256,7 @@ (#.Some root) (let [reference (get@ #key root)] - (`` (cond (~~ (do-template [<comp> <tag> <add>] + (`` (cond (~~ (template [<comp> <tag> <add>] [(<comp> reference key) (let [side-root (get@ <tag> root) outcome (recur side-root)] @@ -537,7 +537,7 @@ (new Order<l>) list)) -(do-template [<name> <type> <output>] +(template [<name> <type> <output>] [(def: #export (<name> dict) (All [k v] (-> (Dictionary k v) (List <type>))) (loop [node (get@ #root dict)] diff --git a/stdlib/source/lux/data/collection/dictionary/plist.lux b/stdlib/source/lux/data/collection/dictionary/plist.lux index 269c8bd02..2e08d72f2 100644 --- a/stdlib/source/lux/data/collection/dictionary/plist.lux +++ b/stdlib/source/lux/data/collection/dictionary/plist.lux @@ -20,7 +20,7 @@ (#.Some v') (get key properties')))) -(do-template [<name> <type> <access>] +(template [<name> <type> <access>] [(def: #export <name> (All [a] (-> (PList a) (List <type>))) (list;map <access>))] diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux index 46042d1d7..b2da3337b 100644 --- a/stdlib/source/lux/data/collection/list.lux +++ b/stdlib/source/lux/data/collection/list.lux @@ -68,7 +68,7 @@ _ #.Nil)) -(do-template [<name> <then> <else>] +(template [<name> <then> <else>] [(def: #export (<name> n xs) (All [a] (-> Nat (List a) (List a))) @@ -85,7 +85,7 @@ [drop (drop (dec n) xs') xs] ) -(do-template [<name> <then> <else>] +(template [<name> <then> <else>] [(def: #export (<name> predicate xs) (All [a] (-> (Predicate a) (List a) (List a))) @@ -235,7 +235,7 @@ (All [a] (-> (List a) Nat)) (fold (function (_ _ acc) (n/+ 1 acc)) 0 list)) -(do-template [<name> <init> <op>] +(template [<name> <init> <op>] [(def: #export (<name> predicate xs) (All [a] (-> (Predicate a) (List a) Bit)) @@ -335,7 +335,7 @@ xs')] ($_ compose (sort < pre) (list x) (sort < post))))) -(do-template [<name> <type> <lt> <gt>] +(template [<name> <type> <lt> <gt>] [(def: #export (<name> from to) {#.doc "Generates an inclusive interval of values [from, to]."} (-> <type> <type> (List <type>)) @@ -365,7 +365,7 @@ (#.Cons x' xs') (or (:: eq = x x') (member? eq xs' x)))) -(do-template [<name> <output> <side> <doc>] +(template [<name> <output> <side> <doc>] [(def: #export (<name> xs) {#.doc <doc>} (All [a] (-> (List a) (Maybe <output>))) diff --git a/stdlib/source/lux/data/collection/row.lux b/stdlib/source/lux/data/collection/row.lux index 16ad5b51a..d56da4b79 100644 --- a/stdlib/source/lux/data/collection/row.lux +++ b/stdlib/source/lux/data/collection/row.lux @@ -40,7 +40,7 @@ Level 0) -(do-template [<name> <op>] +(template [<name> <op>] [(def: <name> (-> Level Level) (<op> branching-exponent))] @@ -428,7 +428,7 @@ (All [a] (-> (Row a) (Row a))) (|>> ..to-list list.reverse (list@fold add ..empty))) -(do-template [<name> <array> <init> <op>] +(template [<name> <array> <init> <op>] [(def: #export <name> (All [a] (-> (Predicate a) (Row a) Bit)) diff --git a/stdlib/source/lux/data/collection/sequence.lux b/stdlib/source/lux/data/collection/sequence.lux index bff7b621e..720515c2d 100644 --- a/stdlib/source/lux/data/collection/sequence.lux +++ b/stdlib/source/lux/data/collection/sequence.lux @@ -51,7 +51,7 @@ (#.Cons x xs') (#.Some (cycle' x xs' x xs')))) -(do-template [<name> <return> <part>] +(template [<name> <return> <part>] [(def: #export (<name> s) (All [a] (-> (Sequence a) <return>)) (let [[h t] (continuation.run s)] @@ -67,7 +67,7 @@ (nth (dec idx) t) h))) -(do-template [<taker> <dropper> <splitter> <pred-type> <pred-test> <pred-step>] +(template [<taker> <dropper> <splitter> <pred-type> <pred-test> <pred-step>] [(def: #export (<taker> pred xs) (All [a] (-> <pred-type> (Sequence a) (List a))) diff --git a/stdlib/source/lux/data/collection/set/ordered.lux b/stdlib/source/lux/data/collection/set/ordered.lux index 1be73506b..4d607ce15 100644 --- a/stdlib/source/lux/data/collection/set/ordered.lux +++ b/stdlib/source/lux/data/collection/set/ordered.lux @@ -24,7 +24,7 @@ (All [a] (-> (Set a) a Bit)) (|> set :representation (/.contains? elem))) - (do-template [<name> <alias>] + (template [<name> <alias>] [(def: #export <name> (All [a] (-> (Set a) (Maybe a))) (|>> :representation <alias>))] @@ -33,7 +33,7 @@ [max /.max] ) - (do-template [<name> <alias>] + (template [<name> <alias>] [(def: #export <name> (-> (Set Any) Nat) (|>> :representation <alias>))] diff --git a/stdlib/source/lux/data/collection/tree/rose/parser.lux b/stdlib/source/lux/data/collection/tree/rose/parser.lux index ba24cd908..17cee8931 100644 --- a/stdlib/source/lux/data/collection/tree/rose/parser.lux +++ b/stdlib/source/lux/data/collection/tree/rose/parser.lux @@ -31,7 +31,7 @@ (exception: #export cannot-move-further) -(do-template [<name> <direction>] +(template [<name> <direction>] [(def: #export <name> (All [t] (Parser t [])) (function (_ zipper) diff --git a/stdlib/source/lux/data/collection/tree/rose/zipper.lux b/stdlib/source/lux/data/collection/tree/rose/zipper.lux index 9472d7d26..1a8ed4d5c 100644 --- a/stdlib/source/lux/data/collection/tree/rose/zipper.lux +++ b/stdlib/source/lux/data/collection/tree/rose/zipper.lux @@ -117,7 +117,7 @@ zipper (start ancestor)))) -(do-template [<one> <all> <side> <op-side>] +(template [<one> <all> <side> <op-side>] [(def: #export (<one> zipper) (All [a] (-> (Zipper a) (Zipper a))) (case (get@ <side> zipper) @@ -239,7 +239,7 @@ (set@ #lefts side) (set@ #node next))))) -(do-template [<name> <side>] +(template [<name> <side>] [(def: #export (<name> value zipper) (All [a] (-> a (Zipper a) (Maybe (Zipper a)))) (case (get@ #parent zipper) diff --git a/stdlib/source/lux/data/color.lux b/stdlib/source/lux/data/color.lux index 7ca1764aa..bd02c4087 100644 --- a/stdlib/source/lux/data/color.lux +++ b/stdlib/source/lux/data/color.lux @@ -254,7 +254,7 @@ #green top #blue top})) -(do-template [<name> <target>] +(template [<name> <target>] [(def: #export (<name> ratio color) (-> Frac Color Color) (interpolate ratio <target> color))] @@ -271,7 +271,7 @@ #green (adjust green) #blue (adjust blue)}))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> ratio color) (-> Frac Color Color) (let [[hue saturation luminance] (to-hsl color)] @@ -292,7 +292,7 @@ +0.0 luminance]))) -(do-template [<name> <1> <2>] +(template [<name> <1> <2>] [(def: #export (<name> color) (-> Color [Color Color Color]) (let [[hue saturation luminance] (to-hsl color)] @@ -309,7 +309,7 @@ [split-complement (|> +1.0 (f// +5.0)) (|> +3.0 (f// +5.0))] ) -(do-template [<name> <1> <2> <3>] +(template [<name> <1> <2> <3>] [(def: #export (<name> color) (-> Color [Color Color Color Color]) (let [[hue saturation luminance] (to-hsl color)] diff --git a/stdlib/source/lux/data/color/named.lux b/stdlib/source/lux/data/color/named.lux index 76b8545f1..09e021727 100644 --- a/stdlib/source/lux/data/color/named.lux +++ b/stdlib/source/lux/data/color/named.lux @@ -4,152 +4,152 @@ [number (#+ hex)]]] ["." // (#+ Color)]) -(do-template [<name> <red> <green> <blue>] +(template [<red> <green> <blue> <name>] [(def: #export <name> Color (//.from-rgb {#//.red (hex <red>) #//.green (hex <green>) #//.blue (hex <blue>)}))] - [alice-blue "F0" "F8" "FF"] - [antique-white "FA" "EB" "D7"] - [aqua "00" "FF" "FF"] - [aquamarine "7F" "FF" "D4"] - [azure "F0" "FF" "FF"] - [beige "F5" "F5" "DC"] - [bisque "FF" "E4" "C4"] - [black "00" "00" "00"] - [blanched-almond "FF" "EB" "CD"] - [blue "00" "00" "FF"] - [blue-violet "8A" "2B" "E2"] - [brown "A5" "2A" "2A"] - [burly-wood "DE" "B8" "87"] - [cadet-blue "5F" "9E" "A0"] - [chartreuse "7F" "FF" "00"] - [chocolate "D2" "69" "1E"] - [coral "FF" "7F" "50"] - [cornflower-blue "64" "95" "ED"] - [cornsilk "FF" "F8" "DC"] - [crimson "DC" "14" "3C"] - [cyan "00" "FF" "FF"] - [dark-blue "00" "00" "8B"] - [dark-cyan "00" "8B" "8B"] - [dark-goldenrod "B8" "86" "0B"] - [dark-gray "A9" "A9" "A9"] - [dark-green "00" "64" "00"] - [dark-khaki "BD" "B7" "6B"] - [dark-magenta "8B" "00" "8B"] - [dark-olive-green "55" "6B" "2F"] - [dark-orange "FF" "8C" "00"] - [dark-orchid "99" "32" "CC"] - [dark-red "8B" "00" "00"] - [dark-salmon "E9" "96" "7A"] - [dark-sea-green "8F" "BC" "8F"] - [dark-slate-blue "48" "3D" "8B"] - [dark-slate-gray "2F" "4F" "4F"] - [dark-turquoise "00" "CE" "D1"] - [dark-violet "94" "00" "D3"] - [deep-pink "FF" "14" "93"] - [deep-sky-blue "00" "BF" "FF"] - [dim-gray "69" "69" "69"] - [dodger-blue "1E" "90" "FF"] - [fire-brick "B2" "22" "22"] - [floral-white "FF" "FA" "F0"] - [forest-green "22" "8B" "22"] - [fuchsia "FF" "00" "FF"] - [gainsboro "DC" "DC" "DC"] - [ghost-white "F8" "F8" "FF"] - [gold "FF" "D7" "00"] - [goldenrod "DA" "A5" "20"] - [gray "80" "80" "80"] - [green "00" "80" "00"] - [green-yellow "AD" "FF" "2F"] - [honey-dew "F0" "FF" "F0"] - [hot-pink "FF" "69" "B4"] - [indian-red "CD" "5C" "5C"] - [indigo "4B" "00" "82"] - [ivory "FF" "FF" "F0"] - [khaki "F0" "E6" "8C"] - [lavender "E6" "E6" "FA"] - [lavender-blush "FF" "F0" "F5"] - [lawn-green "7C" "FC" "00"] - [lemon-chiffon "FF" "FA" "CD"] - [light-blue "AD" "D8" "E6"] - [light-coral "F0" "80" "80"] - [light-cyan "E0" "FF" "FF"] - [light-goldenrod-yellow "FA" "FA" "D2"] - [light-gray "D3" "D3" "D3"] - [light-green "90" "EE" "90"] - [light-pink "FF" "B6" "C1"] - [light-salmon "FF" "A0" "7A"] - [light-sea-green "20" "B2" "AA"] - [light-sky-blue "87" "CE" "FA"] - [light-slate-gray "77" "88" "99"] - [light-steel-blue "B0" "C4" "DE"] - [light-yellow "FF" "FF" "E0"] - [lime "00" "FF" "00"] - [lime-green "32" "CD" "32"] - [linen "FA" "F0" "E6"] - [magenta "FF" "00" "FF"] - [maroon "80" "00" "00"] - [medium-aquamarine "66" "CD" "AA"] - [medium-blue "00" "00" "CD"] - [medium-orchid "BA" "55" "D3"] - [medium-purple "93" "70" "DB"] - [medium-sea-green "3C" "B3" "71"] - [medium-slate-blue "7B" "68" "EE"] - [medium-spring-green "00" "FA" "9A"] - [medium-turquoise "48" "D1" "CC"] - [medium-violet-red "C7" "15" "85"] - [midnight-blue "19" "19" "70"] - [mint-cream "F5" "FF" "FA"] - [misty-rose "FF" "E4" "E1"] - [moccasin "FF" "E4" "B5"] - [navajo-white "FF" "DE" "AD"] - [navy "00" "00" "80"] - [old-lace "FD" "F5" "E6"] - [olive "80" "80" "00"] - [olive-drab "6B" "8E" "23"] - [orange "FF" "A5" "00"] - [orange-red "FF" "45" "00"] - [orchid "DA" "70" "D6"] - [pale-goldenrod "EE" "E8" "AA"] - [pale-green "98" "FB" "98"] - [pale-turquoise "AF" "EE" "EE"] - [pale-violet-red "DB" "70" "93"] - [papaya-whip "FF" "EF" "D5"] - [peach-puff "FF" "DA" "B9"] - [peru "CD" "85" "3F"] - [pink "FF" "C0" "CB"] - [plum "DD" "A0" "DD"] - [powder-blue "B0" "E0" "E6"] - [purple "80" "00" "80"] - [rebecca-purple "66" "33" "99"] - [red "FF" "00" "00"] - [rosy-brown "BC" "8F" "8F"] - [royal-blue "41" "69" "E1"] - [saddle-brown "8B" "45" "13"] - [salmon "FA" "80" "72"] - [sandy-brown "F4" "A4" "60"] - [sea-green "2E" "8B" "57"] - [sea-shell "FF" "F5" "EE"] - [sienna "A0" "52" "2D"] - [silver "C0" "C0" "C0"] - [sky-blue "87" "CE" "EB"] - [slate-blue "6A" "5A" "CD"] - [slate-gray "70" "80" "90"] - [snow "FF" "FA" "FA"] - [spring-green "00" "FF" "7F"] - [steel-blue "46" "82" "B4"] - [tan "D2" "B4" "8C"] - [teal "00" "80" "80"] - [thistle "D8" "BF" "D8"] - [tomato "FF" "63" "47"] - [turquoise "40" "E0" "D0"] - [violet "EE" "82" "EE"] - [wheat "F5" "DE" "B3"] - [white "FF" "FF" "FF"] - [white-smoke "F5" "F5" "F5"] - [yellow "FF" "FF" "00"] - [yellow-green "9A" "CD" "32"] + ["F0" "F8" "FF" alice-blue] + ["FA" "EB" "D7" antique-white] + ["00" "FF" "FF" aqua] + ["7F" "FF" "D4" aquamarine] + ["F0" "FF" "FF" azure] + ["F5" "F5" "DC" beige] + ["FF" "E4" "C4" bisque] + ["00" "00" "00" black] + ["FF" "EB" "CD" blanched-almond] + ["00" "00" "FF" blue] + ["8A" "2B" "E2" blue-violet] + ["A5" "2A" "2A" brown] + ["DE" "B8" "87" burly-wood] + ["5F" "9E" "A0" cadet-blue] + ["7F" "FF" "00" chartreuse] + ["D2" "69" "1E" chocolate] + ["FF" "7F" "50" coral] + ["64" "95" "ED" cornflower-blue] + ["FF" "F8" "DC" cornsilk] + ["DC" "14" "3C" crimson] + ["00" "FF" "FF" cyan] + ["00" "00" "8B" dark-blue] + ["00" "8B" "8B" dark-cyan] + ["B8" "86" "0B" dark-goldenrod] + ["A9" "A9" "A9" dark-gray] + ["00" "64" "00" dark-green] + ["BD" "B7" "6B" dark-khaki] + ["8B" "00" "8B" dark-magenta] + ["55" "6B" "2F" dark-olive-green] + ["FF" "8C" "00" dark-orange] + ["99" "32" "CC" dark-orchid] + ["8B" "00" "00" dark-red] + ["E9" "96" "7A" dark-salmon] + ["8F" "BC" "8F" dark-sea-green] + ["48" "3D" "8B" dark-slate-blue] + ["2F" "4F" "4F" dark-slate-gray] + ["00" "CE" "D1" dark-turquoise] + ["94" "00" "D3" dark-violet] + ["FF" "14" "93" deep-pink] + ["00" "BF" "FF" deep-sky-blue] + ["69" "69" "69" dim-gray] + ["1E" "90" "FF" dodger-blue] + ["B2" "22" "22" fire-brick] + ["FF" "FA" "F0" floral-white] + ["22" "8B" "22" forest-green] + ["FF" "00" "FF" fuchsia] + ["DC" "DC" "DC" gainsboro] + ["F8" "F8" "FF" ghost-white] + ["FF" "D7" "00" gold] + ["DA" "A5" "20" goldenrod] + ["80" "80" "80" gray] + ["00" "80" "00" green] + ["AD" "FF" "2F" green-yellow] + ["F0" "FF" "F0" honey-dew] + ["FF" "69" "B4" hot-pink] + ["CD" "5C" "5C" indian-red] + ["4B" "00" "82" indigo] + ["FF" "FF" "F0" ivory] + ["F0" "E6" "8C" khaki] + ["E6" "E6" "FA" lavender] + ["FF" "F0" "F5" lavender-blush] + ["7C" "FC" "00" lawn-green] + ["FF" "FA" "CD" lemon-chiffon] + ["AD" "D8" "E6" light-blue] + ["F0" "80" "80" light-coral] + ["E0" "FF" "FF" light-cyan] + ["FA" "FA" "D2" light-goldenrod-yellow] + ["D3" "D3" "D3" light-gray] + ["90" "EE" "90" light-green] + ["FF" "B6" "C1" light-pink] + ["FF" "A0" "7A" light-salmon] + ["20" "B2" "AA" light-sea-green] + ["87" "CE" "FA" light-sky-blue] + ["77" "88" "99" light-slate-gray] + ["B0" "C4" "DE" light-steel-blue] + ["FF" "FF" "E0" light-yellow] + ["00" "FF" "00" lime] + ["32" "CD" "32" lime-green] + ["FA" "F0" "E6" linen] + ["FF" "00" "FF" magenta] + ["80" "00" "00" maroon] + ["66" "CD" "AA" medium-aquamarine] + ["00" "00" "CD" medium-blue] + ["BA" "55" "D3" medium-orchid] + ["93" "70" "DB" medium-purple] + ["3C" "B3" "71" medium-sea-green] + ["7B" "68" "EE" medium-slate-blue] + ["00" "FA" "9A" medium-spring-green] + ["48" "D1" "CC" medium-turquoise] + ["C7" "15" "85" medium-violet-red] + ["19" "19" "70" midnight-blue] + ["F5" "FF" "FA" mint-cream] + ["FF" "E4" "E1" misty-rose] + ["FF" "E4" "B5" moccasin] + ["FF" "DE" "AD" navajo-white] + ["00" "00" "80" navy] + ["FD" "F5" "E6" old-lace] + ["80" "80" "00" olive] + ["6B" "8E" "23" olive-drab] + ["FF" "A5" "00" orange] + ["FF" "45" "00" orange-red] + ["DA" "70" "D6" orchid] + ["EE" "E8" "AA" pale-goldenrod] + ["98" "FB" "98" pale-green] + ["AF" "EE" "EE" pale-turquoise] + ["DB" "70" "93" pale-violet-red] + ["FF" "EF" "D5" papaya-whip] + ["FF" "DA" "B9" peach-puff] + ["CD" "85" "3F" peru] + ["FF" "C0" "CB" pink] + ["DD" "A0" "DD" plum] + ["B0" "E0" "E6" powder-blue] + ["80" "00" "80" purple] + ["66" "33" "99" rebecca-purple] + ["FF" "00" "00" red] + ["BC" "8F" "8F" rosy-brown] + ["41" "69" "E1" royal-blue] + ["8B" "45" "13" saddle-brown] + ["FA" "80" "72" salmon] + ["F4" "A4" "60" sandy-brown] + ["2E" "8B" "57" sea-green] + ["FF" "F5" "EE" sea-shell] + ["A0" "52" "2D" sienna] + ["C0" "C0" "C0" silver] + ["87" "CE" "EB" sky-blue] + ["6A" "5A" "CD" slate-blue] + ["70" "80" "90" slate-gray] + ["FF" "FA" "FA" snow] + ["00" "FF" "7F" spring-green] + ["46" "82" "B4" steel-blue] + ["D2" "B4" "8C" tan] + ["00" "80" "80" teal] + ["D8" "BF" "D8" thistle] + ["FF" "63" "47" tomato] + ["40" "E0" "D0" turquoise] + ["EE" "82" "EE" violet] + ["F5" "DE" "B3" wheat] + ["FF" "FF" "FF" white] + ["F5" "F5" "F5" white-smoke] + ["FF" "FF" "00" yellow] + ["9A" "CD" "32" yellow-green] ) diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux index be2e105ee..b794fe029 100644 --- a/stdlib/source/lux/data/format/binary.lux +++ b/stdlib/source/lux/data/format/binary.lux @@ -99,7 +99,7 @@ (let [[valueS valueT] ((get@ #writer format) value)] (|> valueS binary.create (valueT 0)))) -(do-template [<name> <size> <read> <write>] +(template [<name> <size> <read> <write>] [(def: #export <name> (Format (I64 Any)) {#reader (function (_ [offset binary]) @@ -215,7 +215,7 @@ {#reader (:: parser.monad map frac.bits-to-frac reader) #writer (|>> frac.frac-to-bits writer)})) -(do-template [<name> <bits> <size> <write>] +(template [<name> <bits> <size> <write>] [(def: #export <name> (Format Binary) (let [mask (..mask <size>)] @@ -243,7 +243,7 @@ [binary/64 ..bits/64 ..size/64 binary.write/64] ) -(do-template [<name> <binary>] +(template [<name> <binary>] [(def: #export <name> (Format Text) (let [(^open "binary/.") <binary>] @@ -260,7 +260,7 @@ (def: #export text ..utf8/64) -(do-template [<name> <with-offset> <bits> <size> <write>] +(template [<name> <with-offset> <bits> <size> <write>] [(def: #export (<with-offset> extra-count valueF) (All [v] (-> Nat (Format v) (Format (Row v)))) {#reader (do parser.monad diff --git a/stdlib/source/lux/data/format/css.lux b/stdlib/source/lux/data/format/css.lux index 736a5e6f3..2bee92189 100644 --- a/stdlib/source/lux/data/format/css.lux +++ b/stdlib/source/lux/data/format/css.lux @@ -116,7 +116,7 @@ (!compose (..rule selector style) (..alter combinator selector inner))) - (do-template [<name> <combinator>] + (template [<name> <combinator>] [(def: #export <name> (-> (Selector Any) Style (CSS Common) (CSS Common)) (..dependent <combinator>))] diff --git a/stdlib/source/lux/data/format/css/property.lux b/stdlib/source/lux/data/format/css/property.lux index b9e178ede..214a2f3c7 100644 --- a/stdlib/source/lux/data/format/css/property.lux +++ b/stdlib/source/lux/data/format/css/property.lux @@ -60,8 +60,8 @@ (-> (Property Any) Text) (|>> :representation)) - (do-template [<brand> <alias>+ <property>+] - [(`` (do-template [<alias> <property>] + (template [<brand> <alias>+ <property>+] + [(`` (template [<alias> <property>] [(def: #export <alias> (Property <brand>) (:abstraction <property>))] @@ -69,7 +69,7 @@ (~~ (template.splice <alias>+)))) (with-expansions [<rows> (template.splice <property>+)] - (do-template [<property>] + (template [<property>] [(`` (def: #export (~~ (text-identifier <property>)) (Property <brand>) (:abstraction <property>)))] diff --git a/stdlib/source/lux/data/format/css/query.lux b/stdlib/source/lux/data/format/css/query.lux index 1fb1b74bb..92dea7d19 100644 --- a/stdlib/source/lux/data/format/css/query.lux +++ b/stdlib/source/lux/data/format/css/query.lux @@ -29,7 +29,7 @@ (-> Media Text) (|>> :representation)) - (do-template [<media>] + (template [<media>] [(`` (def: #export (~~ (text-identifier <media>)) Media (:abstraction <media>)))] @@ -49,7 +49,7 @@ (-> Feature Text) (|>> :representation)) - (do-template [<feature> <brand>] + (template [<feature> <brand>] [(`` (def: #export ((~~ (text-identifier <feature>)) input) (-> (Value <brand>) Feature) (:abstraction (format "(" <feature> ": " (//value.value input) ")"))))] @@ -111,7 +111,7 @@ (-> Query Text) (|>> :representation)) - (do-template [<name> <operator>] + (template [<name> <operator>] [(def: #export <name> (-> Media Query) (|>> ..media (format <operator>) :abstraction))] @@ -124,7 +124,7 @@ (-> Feature Query) (|>> ..feature (format "not ") :abstraction)) - (do-template [<name> <operator>] + (template [<name> <operator>] [(def: #export (<name> left right) (-> Query Query Query) (:abstraction (format (:representation left) diff --git a/stdlib/source/lux/data/format/css/selector.lux b/stdlib/source/lux/data/format/css/selector.lux index 7b80e4973..3c01a76a3 100644 --- a/stdlib/source/lux/data/format/css/selector.lux +++ b/stdlib/source/lux/data/format/css/selector.lux @@ -18,7 +18,7 @@ (abstract: #export (Generic brand) {} Any) -(do-template [<generic> <brand>] +(template [<generic> <brand>] [(abstract: <brand> {} Any) (type: #export <generic> (Generic <brand>))] @@ -47,7 +47,7 @@ (-> Tag (Selector Cannot-Chain)) (|>> :abstraction)) - (do-template [<name> <type> <prefix> <kind>] + (template [<name> <type> <prefix> <kind>] [(def: #export <name> (-> <type> (Selector <kind>)) (|>> (format <prefix>) :abstraction))] @@ -56,8 +56,8 @@ [class Class "." Can-Chain] ) - (do-template [<right> <left> <combo> <combinator>+] - [(`` (do-template [<combinator> <name>] + (template [<right> <left> <combo> <combinator>+] + [(`` (template [<combinator> <name>] [(def: #export (<name> right left) (-> (Selector <right>) (Selector <left>) (Selector <combo>)) (:abstraction (format (:representation left) @@ -87,7 +87,7 @@ (-> Attribute (Selector Can-Chain)) (:abstraction (format "[" attribute "]"))) - (do-template [<check> <name>] + (template [<check> <name>] [(def: #export (<name> attribute value) (-> Attribute Text (Selector Can-Chain)) (:abstraction (format "[" attribute <check> value "]")))] @@ -100,8 +100,8 @@ ["*=" contains?] ) - (do-template [<kind> <pseudo>+] - [(`` (do-template [<name> <pseudo>] + (template [<kind> <pseudo>+] + [(`` (template [<name> <pseudo>] [(def: #export <name> (Selector Can-Chain) (:abstraction <pseudo>))] @@ -170,7 +170,7 @@ (-> Nat Index) (|>> %n :abstraction)) - (do-template [<name> <index>] + (template [<name> <index>] [(def: #export <name> Index (:abstraction <index>))] [odd "odd"] @@ -189,7 +189,7 @@ (%n (.nat variable))) (%i constant))))) - (do-template [<name> <pseudo>] + (template [<name> <pseudo>] [(def: #export (<name> index) (-> Index (Selector Can-Chain)) (|> (:representation index) diff --git a/stdlib/source/lux/data/format/css/value.lux b/stdlib/source/lux/data/format/css/value.lux index 8967ed90a..1dae87811 100644 --- a/stdlib/source/lux/data/format/css/value.lux +++ b/stdlib/source/lux/data/format/css/value.lux @@ -34,7 +34,7 @@ (-> <abstraction> <representation>) (|>> :representation)) - (`` (do-template [<name> <value>] + (`` (template [<name> <value>] [(def: #export <name> <abstraction> (:abstraction <value>))] (~~ (template.splice <sample>+)) @@ -65,7 +65,7 @@ (-> (Value Any) Text) (|>> :representation)) - (do-template [<name> <value>] + (template [<name> <value>] [(def: #export <name> Value (:abstraction <value>))] [initial "initial"] @@ -73,10 +73,10 @@ [unset "unset"] ) - (do-template [<brand> <alias>+ <value>+] + (template [<brand> <alias>+ <value>+] [(abstract: #export <brand> {} Any) - (`` (do-template [<name> <value>] + (`` (template [<name> <value>] [(def: #export <name> (Value <brand>) (:abstraction <value>))] @@ -84,7 +84,7 @@ (~~ (template.splice <alias>+)))) (with-expansions [<rows> (template.splice <value>+)] - (do-template [<value>] + (template [<value>] [(`` (def: #export (~~ (text-identifier <value>)) (Value <brand>) (:abstraction <value>)))] @@ -800,7 +800,7 @@ (list;map %number) (..apply "cubic-bezier"))) - (do-template [<name> <brand>] + (template [<name> <brand>] [(def: #export <name> (-> Nat (Value <brand>)) (|>> %n :abstraction))] @@ -833,7 +833,7 @@ "1.0" (format "0" (%r alpha))))))) - (do-template [<name> <suffix>] + (template [<name> <suffix>] [(def: #export (<name> value) (-> Frac (Value Length)) (:abstraction (format (%number value) <suffix>)))] @@ -862,7 +862,7 @@ (%i value) (%n (.nat value)))) - (do-template [<name> <suffix>] + (template [<name> <suffix>] [(def: #export (<name> value) (-> Int (Value Time)) (:abstraction (format (if (i/< +0 value) @@ -948,7 +948,7 @@ (-> Nat Angle) (:abstraction (format (%n (n/% ..degree-limit value)) "deg"))) - (do-template [<degree> <name>] + (template [<degree> <name>] [(def: #export <name> Angle (..degree <degree>))] [000 to-top] @@ -957,7 +957,7 @@ [270 to-left] ) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> angle start next) (-> Angle Stop (List/1 [(Maybe Hint) Stop]) (Value Image)) (let [[now after] next] @@ -994,8 +994,8 @@ (:abstraction Value (format (:representation horizontal) ..slice-separator (:representation vertical)))) - (do-template [<input> <pre> <function>+] - [(`` (do-template [<name> <function>] + (template [<input> <pre> <function>+] + [(`` (template [<name> <function>] [(def: #export <name> (-> <input> (Value Filter)) (|>> <pre> (list) (..apply <function>)))] @@ -1039,7 +1039,7 @@ (def: length-separator " ") - (do-template [<name> <type>] + (template [<name> <type>] [(def: #export (<name> horizontal vertical) (-> (Value Length) (Value Length) (Value <type>)) (:abstraction (format (:representation horizontal) @@ -1074,7 +1074,7 @@ [farthest-corner "farthest-corner"]] []) - (do-template [<name> <function>] + (template [<name> <function>] [(def: #export (<name> shape extent location start next) (-> Shape (Maybe Extent) (Value Location) Stop (List/1 [(Maybe Hint) Stop]) @@ -1121,7 +1121,7 @@ (def: #export (clip rectangle) (-> Rectangle (Value Clip)) - (`` (..apply "rect" (list (~~ (do-template [<side>] + (`` (..apply "rect" (list (~~ (template [<side>] [(:representation (get@ <side> rectangle))] [#top] [#right] [#bottom] [#left])))))) @@ -1261,7 +1261,7 @@ (list;map %number) (..apply "matrix3d"))) - (do-template [<name> <function> <input-types> <input-values>] + (template [<name> <function> <input-types> <input-values>] [(`` (def: #export (<name> [(~~ (template.splice <input-values>))]) (-> [(~~ (template.splice <input-types>))] (Value Transform)) (|> (list (~~ (template.splice <input-values>))) @@ -1283,7 +1283,7 @@ [perspective "perspective" [Frac] [value]] ) - (do-template [<name> <function> <input-types> <input-values>] + (template [<name> <function> <input-types> <input-values>] [(`` (def: #export (<name> [(~~ (template.splice <input-values>))]) (-> [(~~ (template.splice <input-types>))] (Value Transform)) (|> (list (~~ (template.splice <input-values>))) diff --git a/stdlib/source/lux/data/format/html.lux b/stdlib/source/lux/data/format/html.lux index 206485991..01b7d9df1 100644 --- a/stdlib/source/lux/data/format/html.lux +++ b/stdlib/source/lux/data/format/html.lux @@ -80,7 +80,7 @@ Text - (do-template [<name> <brand>] + (template [<name> <brand>] [(abstract: #export <brand> {} Any) (type: #export <name> (HTML <brand>))] @@ -98,11 +98,11 @@ [Document Document'] ) - (do-template [<super> <super-raw> <sub>+] + (template [<super> <super-raw> <sub>+] [(abstract: #export (<super-raw> brand) {} Any) (type: #export <super> (HTML (<super-raw> Any))) - (`` (do-template [<sub> <sub-raw>] + (`` (template [<sub> <sub-raw>] [(abstract: #export <sub-raw> {} Any) (type: #export <sub> (HTML (<super-raw> <sub-raw>)))] @@ -157,7 +157,7 @@ content (..close tag)))) - (do-template [<name> <tag> <brand>] + (template [<name> <tag> <brand>] [(def: #export <name> (-> Attributes <brand>) (..simple <tag>))] @@ -197,7 +197,7 @@ (|>> ..sanitize :abstraction)) - (do-template [<tag> <alias> <name>] + (template [<tag> <alias> <name>] [(def: #export <name> Element (..simple <tag> (list))) @@ -264,7 +264,7 @@ (#Circle Circle) (#Polygon Polygon)) - (do-template [<name> <shape> <type> <format>] + (template [<name> <shape> <type> <format>] [(def: (<name> attributes shape) (-> Attributes <type> (HTML Any)) (..simple "area" (list& ["shape" <shape>] @@ -300,7 +300,7 @@ (..tag "map" attributes (list@fold (function.flip ..and) head tail))))) - (do-template [<name> <tag> <type>] + (template [<name> <tag> <type>] [(def: #export <name> (-> Attributes <type>) (..empty <tag>))] @@ -312,7 +312,7 @@ [track "track" Track] ) - (do-template [<name> <tag>] + (template [<name> <tag>] [(def: #export (<name> attributes media on-unsupported) (-> Attributes Media (Maybe Content) Element) (..tag <tag> attributes @@ -336,7 +336,7 @@ (-> ID Input) (|>> ["for"] list (..empty "label"))) - (do-template [<name> <container-tag> <description-tag> <type>] + (template [<name> <container-tag> <description-tag> <type>] [(def: #export (<name> description attributes content) (-> (Maybe Content) Attributes <type> <type>) (..tag <container-tag> attributes @@ -354,7 +354,7 @@ [figure "figure" "figcaption" Element] ) - (do-template [<name> <tag> <type>] + (template [<name> <tag> <type>] [(def: #export (<name> attributes content) (-> Attributes (Maybe Content) <type>) (|> content @@ -367,7 +367,7 @@ (type: #export Phrase (-> Attributes Content Element)) - (do-template [<name> <tag>] + (template [<name> <tag>] [(def: #export <name> Phrase (..tag <tag>))] @@ -423,7 +423,7 @@ (type: #export Composite (-> Attributes Element Element)) - (do-template [<name> <tag>] + (template [<name> <tag>] [(def: #export <name> Composite (..tag <tag>))] @@ -441,7 +441,7 @@ [span "span"] ) - (do-template [<tag> <name> <input>] + (template [<tag> <name> <input>] [(def: <name> (-> <input> (HTML Any)) (..tag <tag> (list)))] @@ -466,7 +466,7 @@ (def: #export p ..paragraph) - (do-template [<name> <tag> <input> <output>] + (template [<name> <tag> <input> <output>] [(def: #export <name> (-> Attributes <input> <output>) (..tag <tag>))] @@ -485,7 +485,7 @@ [object "object" Parameter Element] ) - (do-template [<name> <tag> <input> <output>] + (template [<name> <tag> <input> <output>] [(def: #export <name> (-> <input> <output>) (..tag <tag> (list)))] @@ -499,7 +499,7 @@ [body "body" Element Body] ) - (do-template [<name> <tag> <input> <output>] + (template [<name> <tag> <input> <output>] [(def: <name> (-> <input> <output>) (..tag <tag> (list)))] @@ -546,7 +546,7 @@ (..tag "table" attributes content))) - (do-template [<name> <doc-type>] + (template [<name> <doc-type>] [(def: #export <name> (-> Head Body Document) (let [doc-type <doc-type>] diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 64064fb1f..b03cb5ae9 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -26,7 +26,7 @@ ["s" syntax (#+ syntax:)] ["." code]]]) -(do-template [<name> <type>] +(template [<name> <type>] [(type: #export <name> <type>)] [Null Any] @@ -43,7 +43,7 @@ (#Array (Row JSON)) (#Object (Dictionary String JSON))) -(do-template [<name> <type>] +(template [<name> <type>] [(type: #export <name> <type>)] [Array (Row JSON)] @@ -130,7 +130,7 @@ _ (#error.Failure ($_ text@compose "Cannot set field '" key "' of a non-object.")))) -(do-template [<name> <tag> <type> <desc>] +(template [<name> <tag> <type> <desc>] [(def: #export (<name> key json) {#.doc (code.text ($_ text@compose "A JSON object field getter for " <desc> "."))} (-> Text JSON (Error <type>)) @@ -211,7 +211,7 @@ (def: (show-null _) (-> Null Text) "null") -(do-template [<name> <type> <codec>] +(template [<name> <type> <codec>] [(def: <name> (-> <type> Text) <codec>)] [show-boolean Boolean ..encode-boolean] @@ -290,7 +290,7 @@ (#.Cons head tail) (#error.Success [tail head])))) -(do-template [<name> <type> <tag> <desc>] +(template [<name> <type> <tag> <desc>] [(def: #export <name> {#.doc (code.text ($_ text@compose "Reads a JSON value as " <desc> "."))} (Reader <type>) @@ -309,7 +309,7 @@ [string Text #String "string"] ) -(do-template [<test> <check> <type> <eq> <encoder> <tag> <desc>] +(template [<test> <check> <type> <eq> <encoder> <tag> <desc>] [(def: #export (<test> test) {#.doc (code.text ($_ text@compose "Asks whether a JSON value is a " <desc> "."))} (-> <type> (Reader Bit)) @@ -448,7 +448,7 @@ [_ (l.this "null")] (wrap []))) -(do-template [<name> <token> <value>] +(template [<name> <token> <value>] [(def: <name> (l.Lexer Boolean) (do p.monad @@ -527,7 +527,7 @@ value (json~ [])] (wrap [key value]))) -(do-template [<name> <type> <open> <close> <elem-parser> <prep>] +(template [<name> <type> <open> <close> <elem-parser> <prep>] [(def: (<name> json~) (-> (-> Any (l.Lexer JSON)) (l.Lexer <type>)) (do p.monad diff --git a/stdlib/source/lux/data/format/markdown.lux b/stdlib/source/lux/data/format/markdown.lux index 81c7118e7..b5dcbc46f 100644 --- a/stdlib/source/lux/data/format/markdown.lux +++ b/stdlib/source/lux/data/format/markdown.lux @@ -48,7 +48,7 @@ (def: blank-line (format text.new-line text.new-line)) - (do-template [<name> <prefix>] + (template [<name> <prefix>] [(def: #export (<name> content) (-> Text Markdown) (:abstraction (format <prefix> " " (..sanitize content) ..blank-line)))] @@ -73,7 +73,7 @@ (Markdown Span) (:abstraction (format " " text.new-line))) - (do-template [<name> <wrapper>] + (template [<name> <wrapper>] [(def: #export <name> (-> (Markdown Span) (Markdown Span)) (|>> :representation @@ -158,7 +158,7 @@ (type: #export Email Text) - (do-template [<name> <type>] + (template [<name> <type>] [(def: #export <name> (-> <type> (Markdown Span)) (|>> (text.enclose ["<" ">"]) :abstraction))] @@ -167,7 +167,7 @@ [email Email] ) - (do-template [<name> <brand> <infix>] + (template [<name> <brand> <infix>] [(def: #export (<name> pre post) (-> (Markdown <brand>) (Markdown <brand>) (Markdown <brand>)) (:abstraction (format (:representation pre) <infix> (:representation post))))] diff --git a/stdlib/source/lux/data/name.lux b/stdlib/source/lux/data/name.lux index 0c658678b..286071169 100644 --- a/stdlib/source/lux/data/name.lux +++ b/stdlib/source/lux/data/name.lux @@ -12,7 +12,7 @@ ## [Text Text]) ## [Functions] -(do-template [<name> <side>] +(template [<name> <side>] [(def: #export (<name> [module short]) (-> Name Text) <side>)] diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index eb3946fab..b4408518e 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -40,7 +40,7 @@ (-> Text Text) (text.replace-all "," "")) -(do-template [<macro> <nat> <int> <rev> <frac> <error> <doc>] +(template [<macro> <nat> <int> <rev> <frac> <error> <doc>] [(macro: #export (<macro> tokens state) {#.doc <doc>} (case tokens diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux index d8c365bd5..d8334d104 100644 --- a/stdlib/source/lux/data/number/complex.lux +++ b/stdlib/source/lux/data/number/complex.lux @@ -48,7 +48,7 @@ (f/= (get@ #imaginary param) (get@ #imaginary input)))) -(do-template [<name> <op>] +(template [<name> <op>] [(def: #export (<name> param input) (-> Complex Complex Complex) {#real (<op> (get@ #real param) @@ -220,7 +220,7 @@ {#real (|> subject ..abs (get@ #real) math.log) #imaginary (math.atan2 real imaginary)})) -(do-template [<name> <type> <op>] +(template [<name> <type> <op>] [(def: #export (<name> param input) (-> <type> Complex Complex) (|> input log (<op> param) exp))] diff --git a/stdlib/source/lux/data/number/frac.lux b/stdlib/source/lux/data/number/frac.lux index 02f7b4d88..924831dcf 100644 --- a/stdlib/source/lux/data/number/frac.lux +++ b/stdlib/source/lux/data/number/frac.lux @@ -45,7 +45,7 @@ +1.0)) ) -(do-template [<name> <compose> <identity>] +(template [<name> <compose> <identity>] [(structure: #export <name> (Monoid Frac) (def: identity <identity>) (def: compose <compose>))] @@ -56,7 +56,7 @@ [minimum f/min ("lux frac max")] ) -(do-template [<name> <numerator> <doc>] +(template [<name> <numerator> <doc>] [(def: #export <name> {#.doc <doc>} Frac @@ -92,7 +92,7 @@ #.None (#error.Failure "Could not decode Frac")))) -(do-template [<struct> <int> <base> <char-set> <error>] +(template [<struct> <int> <base> <char-set> <error>] [(structure: #export <struct> (Codec Text Frac) (def: (encode value) (let [whole (frac-to-int value) @@ -248,7 +248,7 @@ (#.Cons x xs') ("lux text concat" x (re-join-chunks xs')))) -(do-template [<from> <from-translator> <to> <to-translator> <base-bits>] +(template [<from> <from-translator> <to> <to-translator> <base-bits>] [(def: (<from> on-left? input) (-> Bit Text Text) (let [max-num-chars (n// <base-bits> 64) @@ -281,7 +281,7 @@ [binary-to-octal bin-segment-to-octal octal-to-binary octal-segment-to-bin 3] ) -(do-template [<struct> <error> <from> <to>] +(template [<struct> <error> <from> <to>] [(structure: #export <struct> (Codec Text Frac) (def: (encode value) (let [sign (:: ..number signum value) @@ -336,7 +336,7 @@ (def: mantissa-size Nat 52) (def: exponent-size Nat 11) -(do-template [<hex> <name>] +(template [<hex> <name>] [(def: <name> (|> <hex> (:: //nat.hex decode) error.assume .i64))] ["7FF7FFFFFFFFFFFF" not-a-number-bits] @@ -385,7 +385,7 @@ (//i64.clear mantissa-size mantissa-bits))) ))) -(do-template [<getter> <mask> <size> <offset>] +(template [<getter> <mask> <size> <offset>] [(def: <mask> (|> 1 (//i64.left-shift <size>) dec (//i64.left-shift <offset>))) (def: (<getter> input) (-> (I64 Any) I64) diff --git a/stdlib/source/lux/data/number/i64.lux b/stdlib/source/lux/data/number/i64.lux index 6f30bcb44..321c628e9 100644 --- a/stdlib/source/lux/data/number/i64.lux +++ b/stdlib/source/lux/data/number/i64.lux @@ -12,7 +12,7 @@ (n/* bits-per-byte bytes-per-i64)) -(do-template [<name> <op> <doc>] +(template [<name> <op> <doc>] [(def: #export (<name> param subject) {#.doc <doc>} (All [s] (-> (I64 Any) (I64 s) (I64 s))) @@ -42,7 +42,7 @@ (def: compose ..and) ) -(do-template [<name> <op> <doc>] +(template [<name> <op> <doc>] [(def: #export (<name> param subject) {#.doc <doc>} (All [s] (-> Nat (I64 s) (I64 s))) @@ -83,7 +83,7 @@ (All [s] (-> Nat (I64 s) (I64 s))) (|> idx flag ..not (..and input))) -(do-template [<name> <op> <doc>] +(template [<name> <op> <doc>] [(def: #export (<name> idx input) {#.doc <doc>} (All [s] (-> Nat (I64 s) (I64 s))) @@ -97,7 +97,7 @@ (-> Nat (I64 Any) Bit) (|> input (:coerce I64) (..and (flag idx)) (n/= 0) .not)) -(do-template [<name> <main> <comp>] +(template [<name> <main> <comp>] [(def: #export (<name> distance input) (All [s] (-> Nat (I64 s) (I64 s))) (let [backwards-distance (n/- (n/% width distance) width)] diff --git a/stdlib/source/lux/data/number/int.lux b/stdlib/source/lux/data/number/int.lux index 679147008..9a2ce2b9b 100644 --- a/stdlib/source/lux/data/number/int.lux +++ b/stdlib/source/lux/data/number/int.lux @@ -54,7 +54,7 @@ +1)) ) -(do-template [<name> <compose> <identity>] +(template [<name> <compose> <identity>] [(structure: #export <name> (Monoid Int) (def: identity <identity>) (def: compose <compose>))] @@ -97,7 +97,7 @@ (|> output (i/* <base>) (i/+ (.int digit-value))))) (#error.Success (i/* sign output))))) -(do-template [<struct> <base> <to-character> <to-value> <error>] +(template [<struct> <base> <to-character> <to-value> <error>] [(structure: #export <struct> (Codec Text Int) (def: (encode value) (if (i/= +0 value) diff --git a/stdlib/source/lux/data/number/nat.lux b/stdlib/source/lux/data/number/nat.lux index 70f8df0bd..fb47d2460 100644 --- a/stdlib/source/lux/data/number/nat.lux +++ b/stdlib/source/lux/data/number/nat.lux @@ -48,7 +48,7 @@ 0 0 _ 1))) -(do-template [<name> <compose> <identity>] +(template [<name> <compose> <identity>] [(structure: #export <name> (Monoid Nat) (def: identity <identity>) (def: compose <compose>))] @@ -171,7 +171,7 @@ (^or (^ (char "f")) (^ (char "F"))) (#.Some 15) _ #.None)) -(do-template [<struct> <base> <to-character> <to-value> <error>] +(template [<struct> <base> <to-character> <to-value> <error>] [(structure: #export <struct> (Codec Text Nat) (def: (encode value) (loop [input value diff --git a/stdlib/source/lux/data/number/ratio.lux b/stdlib/source/lux/data/number/ratio.lux index 9c7baaab8..49ce1f194 100644 --- a/stdlib/source/lux/data/number/ratio.lux +++ b/stdlib/source/lux/data/number/ratio.lux @@ -48,7 +48,7 @@ (`` (structure: #export order (Order Ratio) (def: &equivalence ..equivalence) - (~~ (do-template [<name> <op>] + (~~ (template [<name> <op>] [(def: (<name> parameter subject) (let [[parameter' subject'] (..equalize parameter subject)] (<op> parameter' subject')))] @@ -60,7 +60,7 @@ )) )) -(do-template [<name> <comp>] +(template [<name> <comp>] [(def: #export (<name> left right) (-> Ratio Ratio Ratio) (if (:: ..order <comp> left right) @@ -142,7 +142,7 @@ #..denominator (~ (maybe.default (' 1) ?denominator))}))))) -(do-template [<identity> <compose> <name>] +(template [<identity> <compose> <name>] [(structure: #export <name> (Monoid Ratio) diff --git a/stdlib/source/lux/data/number/rev.lux b/stdlib/source/lux/data/number/rev.lux index 7a8fe53da..fa79f597d 100644 --- a/stdlib/source/lux/data/number/rev.lux +++ b/stdlib/source/lux/data/number/rev.lux @@ -40,7 +40,7 @@ (def: top (.rev -1)) (def: bottom (.rev 0))) -(do-template [<name> <compose> <identity>] +(template [<name> <compose> <identity>] [(structure: #export <name> (Monoid Rev) (def: identity (:: interval <identity>)) (def: compose <compose>))] @@ -54,7 +54,7 @@ (-> Text Text) ("lux text clip" input 1 ("lux text size" input))) -(do-template [<struct> <codec> <char-bit-size> <error>] +(template [<struct> <codec> <char-bit-size> <error>] [(with-expansions [<error-output> (as-is (#error.Failure ("lux text concat" <error> repr)))] (structure: #export <struct> (Codec Text Rev) (def: (encode value) diff --git a/stdlib/source/lux/data/product.lux b/stdlib/source/lux/data/product.lux index 257ac8ec2..baa78dd45 100644 --- a/stdlib/source/lux/data/product.lux +++ b/stdlib/source/lux/data/product.lux @@ -3,7 +3,7 @@ lux) ## [Functions] -(do-template [<name> <type> <output>] +(template [<name> <type> <output>] [(def: #export (<name> xy) (All [a b] (-> [a b] <type>)) (let [[x y] xy] diff --git a/stdlib/source/lux/data/sum.lux b/stdlib/source/lux/data/sum.lux index edb9d19fd..2f7624113 100644 --- a/stdlib/source/lux/data/sum.lux +++ b/stdlib/source/lux/data/sum.lux @@ -2,7 +2,7 @@ {#.doc "Functionality for working with variants (particularly 2-variants)."} lux) -(do-template [<name> <type> <index>] +(template [<name> <type> <index>] [(def: #export (<name> value) (All [a b] (-> <type> (| a b))) (<index> value))] @@ -28,7 +28,7 @@ (0 l) (0 (fl l)) (1 r) (1 (fr r))))) -(do-template [<name> <side> <tag>] +(template [<name> <side> <tag>] [(def: #export (<name> es) (All [a b] (-> (List (| a b)) (List <side>))) (case es diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index 00ad654e2..110afd81d 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -25,7 +25,7 @@ (-> Char Text) (|>> (:coerce Int) "lux int char")) -(do-template [<name> <code>] +(template [<name> <code>] [(def: #export <name> (from-code <code>))] [null 0] diff --git a/stdlib/source/lux/data/text/encoding.lux b/stdlib/source/lux/data/text/encoding.lux index 55cb06ef3..8f59bd530 100644 --- a/stdlib/source/lux/data/text/encoding.lux +++ b/stdlib/source/lux/data/text/encoding.lux @@ -20,7 +20,7 @@ Text - (do-template [<name> <encoding>] + (template [<name> <encoding>] [(def: #export <name> Encoding (:abstraction <encoding>))] [ascii "ASCII"] diff --git a/stdlib/source/lux/data/text/format.lux b/stdlib/source/lux/data/text/format.lux index b96606cdc..0becf8633 100644 --- a/stdlib/source/lux/data/text/format.lux +++ b/stdlib/source/lux/data/text/format.lux @@ -40,7 +40,7 @@ {#.doc "A way to produce readable text from values."} (-> a Text)) -(do-template [<name> <type> <formatter>] +(template [<name> <type> <formatter>] [(def: #export <name> (Format <type>) <formatter>)] @@ -81,10 +81,6 @@ (def: #export (%list formatter) (All [a] (-> (Format a) (Format (List a)))) - (function (_ values) - (case values - #.Nil - "(list)" - - _ - (format "(list " (text.join-with " " (list@map formatter values)) ")")))) + (|>> (list@map (|>> formatter (format " "))) + (text.join-with "") + (text.enclose ["(list" ")"]))) diff --git a/stdlib/source/lux/data/text/lexer.lux b/stdlib/source/lux/data/text/lexer.lux index 923fb91a8..e5f19edf6 100644 --- a/stdlib/source/lux/data/text/lexer.lux +++ b/stdlib/source/lux/data/text/lexer.lux @@ -85,7 +85,7 @@ {#basis offset #distance 1}]))) -(do-template [<name> <type> <any>] +(template [<name> <type> <any>] [(def: #export (<name> p) {#.doc "Produce a character if the lexer fails."} (All [a] (-> (Lexer a) (Lexer <type>))) @@ -169,7 +169,7 @@ (n/<= top char')))] (wrap char))) -(do-template [<name> <bottom> <top> <desc>] +(template [<name> <bottom> <top> <desc>] [(def: #export <name> {#.doc (code.text ($_ //;compose "Only lex " <desc> " characters."))} (Lexer Text) @@ -199,7 +199,7 @@ (range (char "a") (char "f")) (range (char "A") (char "F")))) -(do-template [<name> <description-modifier> <modifier>] +(template [<name> <description-modifier> <modifier>] [(def: #export (<name> options) {#.doc (code.text ($_ //;compose "Only lex characters that are" <description-modifier> " part of a piece of text."))} (-> Text (Lexer Text)) @@ -220,7 +220,7 @@ [none-of " not" .not] ) -(do-template [<name> <description-modifier> <modifier>] +(template [<name> <description-modifier> <modifier>] [(def: #export (<name> options) {#.doc (code.text ($_ //;compose "Only lex characters that are" <description-modifier> " part of a piece of text."))} (-> Text (Lexer Slice)) @@ -275,7 +275,7 @@ [right::basis right::distance] right] (wrap [left::basis ("lux i64 +" left::distance right::distance)]))) -(do-template [<name> <base> <doc-modifier>] +(template [<name> <base> <doc-modifier>] [(def: #export (<name> lexer) {#.doc (code.text ($_ //;compose "Lex " <doc-modifier> " characters as a single continuous text."))} (-> (Lexer Text) (Lexer Text)) @@ -285,7 +285,7 @@ [many p.many "many"] ) -(do-template [<name> <base> <doc-modifier>] +(template [<name> <base> <doc-modifier>] [(def: #export (<name> lexer) {#.doc (code.text ($_ //;compose "Lex " <doc-modifier> " characters as a single continuous text."))} (-> (Lexer Slice) (Lexer Slice)) @@ -295,7 +295,7 @@ [many! p.many "many"] ) -(do-template [<name> <base> <doc-modifier>] +(template [<name> <base> <doc-modifier>] [(def: #export (<name> amount lexer) {#.doc (code.text ($_ //;compose "Lex " <doc-modifier> " N characters."))} (-> Nat (Lexer Text) (Lexer Text)) @@ -306,7 +306,7 @@ [at-least p.at-least "at least"] ) -(do-template [<name> <base> <doc-modifier>] +(template [<name> <base> <doc-modifier>] [(def: #export (<name> amount lexer) {#.doc (code.text ($_ //;compose "Lex " <doc-modifier> " N characters."))} (-> Nat (Lexer Slice) (Lexer Slice)) diff --git a/stdlib/source/lux/data/text/unicode.lux b/stdlib/source/lux/data/text/unicode.lux index 951bfe761..11a98b358 100644 --- a/stdlib/source/lux/data/text/unicode.lux +++ b/stdlib/source/lux/data/text/unicode.lux @@ -36,7 +36,7 @@ (-> Char Char Segment) (:abstraction (interval.between nat.enum (n/min start end) (n/max start end)))) - (do-template [<name> <slot>] + (template [<name> <slot>] [(def: #export <name> (-> Segment Char) (|>> :representation (get@ <slot>)))] @@ -56,7 +56,7 @@ (interval.within? (:representation segment) char)) ) -(do-template [<name> <start> <end>] +(template [<name> <start> <end>] [(def: #export <name> Segment (..segment (hex <start>) (hex <end>)))] ## Normal segments @@ -347,7 +347,7 @@ Set (finger.branch (set half/0) (set half/1))) -(do-template [<name> <segments>] +(template [<name> <segments>] [(def: #export <name> Set (set <segments>))] [ascii (list basic-latin)] |