diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/data/format/binary.lux | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/stdlib/source/library/lux/data/format/binary.lux b/stdlib/source/library/lux/data/format/binary.lux index 1f257ea7e..290996b4e 100644 --- a/stdlib/source/library/lux/data/format/binary.lux +++ b/stdlib/source/library/lux/data/format/binary.lux @@ -33,9 +33,10 @@ ["[0]" i64] ["[0]" frac]]]]]) -(template [<name> <extension> <post>] - [(template: (<name> <parameter> <subject>) - [(<post> (<extension> (.int <parameter>) (.int <subject>)))])] +(with_template [<name> <extension> <post>] + [(def: <name> + (template (<name> <parameter> <subject>) + [(<post> (<extension> (.int <parameter>) (.int <subject>)))]))] [n#= "lux i64 =" .|>] [n#+ "lux i64 +" .nat] @@ -77,7 +78,7 @@ (All (_ a) (-> (Writer a) a Binary)) (..instance (writer value))) -(template [<name> <size> <write>] +(with_template [<name> <size> <write>] [(def: .public <name> (Writer (I64 Any)) (function (_ value) @@ -96,7 +97,7 @@ (All (_ l r) (-> (Writer l) (Writer r) (Writer (Or l r)))) (function (_ altV) (case altV - (^.template [<number> <tag> <writer>] + (^.with_template [<number> <tag> <writer>] [{<tag> caseV} (let [[caseS caseT] (<writer> caseV)] [(.++ caseS) @@ -127,7 +128,7 @@ (Writer Bit) (|>> (pipe.case #0 0 #1 1) ..bits_8)) -(template [<name> <type>] +(with_template [<name> <type>] [(def: .public <name> (Writer <type>) ..bits_64)] [nat Nat] @@ -151,7 +152,7 @@ offset binary)])])) -(template [<name> <bits> <size> <write>] +(with_template [<name> <bits> <size> <write>] [(def: .public <name> (Writer Binary) (let [mask (..mask <size>)] @@ -171,7 +172,7 @@ [binary_64 ..bits_64 </>.size_64 /.has_64!] ) -(template [<name> <binary>] +(with_template [<name> <binary>] [(def: .public <name> (Writer Text) (|>> (at utf8.codec encoded) <binary>))] @@ -184,7 +185,7 @@ (def: .public text ..utf8_64) -(template [<name> <size> <write>] +(with_template [<name> <size> <write>] [(def: .public (<name> valueW) (All (_ v) (-> (Writer v) (Writer (Sequence v)))) (function (_ value) @@ -241,7 +242,7 @@ quantified (..and (..list again) again)] (function (_ altV) (case altV - (^.template [<number> <tag> <writer>] + (^.with_template [<number> <tag> <writer>] [{<tag> caseV} (let [[caseS caseT] (<writer> caseV)] [(.++ caseS) @@ -275,7 +276,7 @@ (..and ..location (function (_ altV) (case altV - (^.template [<number> <tag> <writer>] + (^.with_template [<number> <tag> <writer>] [{<tag> caseV} (let [[caseS caseT] (<writer> caseV)] [(.++ caseS) |