aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/data/text/buffer.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/library/lux/data/text/buffer.lux')
-rw-r--r--stdlib/source/library/lux/data/text/buffer.lux76
1 files changed, 38 insertions, 38 deletions
diff --git a/stdlib/source/library/lux/data/text/buffer.lux b/stdlib/source/library/lux/data/text/buffer.lux
index 98526e286..eb1cecf59 100644
--- a/stdlib/source/library/lux/data/text/buffer.lux
+++ b/stdlib/source/library/lux/data/text/buffer.lux
@@ -16,7 +16,7 @@
[number
["n" nat]]]
[type
- abstract]]]
+ [abstract {"-" pattern}]]]]
["[0]" //])
(with_expansions [<jvm> (as_is (import: java/lang/CharSequence
@@ -58,78 +58,78 @@
(def: .public empty
Buffer
- (:abstraction (with_expansions [<jvm> [0 function.identity]]
- (for @.old <jvm>
- @.jvm <jvm>
- @.js [0 function.identity]
- @.lua [0 function.identity]
- ... default
- sequence.empty))))
+ (abstraction (with_expansions [<jvm> [0 function.identity]]
+ (for @.old <jvm>
+ @.jvm <jvm>
+ @.js [0 function.identity]
+ @.lua [0 function.identity]
+ ... default
+ sequence.empty))))
(def: .public (then chunk buffer)
(-> Text Buffer Buffer)
- (with_expansions [<jvm> (let [[capacity transform] (:representation buffer)
- then! (: (-> Text java/lang/StringBuilder java/lang/StringBuilder)
- (function (_ chunk builder)
- (exec
- (java/lang/Appendable::append (:as java/lang/CharSequence chunk)
- builder)
- builder)))]
- (:abstraction [(n.+ (//.size chunk) capacity)
- (|>> transform (then! chunk))]))]
+ (with_expansions [<jvm> (let [[capacity transform] (representation buffer)
+ then! (is (-> Text java/lang/StringBuilder java/lang/StringBuilder)
+ (function (_ chunk builder)
+ (exec
+ (java/lang/Appendable::append (as java/lang/CharSequence chunk)
+ builder)
+ builder)))]
+ (abstraction [(n.+ (//.size chunk) capacity)
+ (|>> transform (then! chunk))]))]
(for @.old <jvm>
@.jvm <jvm>
- @.js (let [[capacity transform] (:representation buffer)
- then! (: (-> (JS_Array Text) (JS_Array Text))
- (function (_ array)
- (exec
- (JS_Array::push chunk array)
- array)))]
- (:abstraction [(n.+ (//.size chunk) capacity)
- (|>> transform then!)]))
- @.lua (let [[capacity transform] (:representation buffer)
- then! (: (-> (array.Array Text) (array.Array Text))
+ @.js (let [[capacity transform] (representation buffer)
+ then! (is (-> (JS_Array Text) (JS_Array Text))
(function (_ array)
(exec
- (table/insert array chunk)
+ (JS_Array::push chunk array)
array)))]
- (:abstraction [(n.+ (//.size chunk) capacity)
- (|>> transform then!)]))
+ (abstraction [(n.+ (//.size chunk) capacity)
+ (|>> transform then!)]))
+ @.lua (let [[capacity transform] (representation buffer)
+ then! (is (-> (array.Array Text) (array.Array Text))
+ (function (_ array)
+ (exec
+ (table/insert array chunk)
+ array)))]
+ (abstraction [(n.+ (//.size chunk) capacity)
+ (|>> transform then!)]))
... default
- (|> buffer :representation (sequence.suffix chunk) :abstraction))))
+ (|> buffer representation (sequence.suffix chunk) abstraction))))
(def: .public size
(-> Buffer Nat)
- (with_expansions [<jvm> (|>> :representation product.left)]
+ (with_expansions [<jvm> (|>> representation product.left)]
(for @.old <jvm>
@.jvm <jvm>
@.js <jvm>
@.lua <jvm>
... default
- (|>> :representation
+ (|>> representation
(sequence#mix (function (_ chunk total)
(n.+ (//.size chunk) total))
0)))))
(def: .public (text buffer)
(-> Buffer Text)
- (with_expansions [<jvm> (let [[capacity transform] (:representation buffer)]
+ (with_expansions [<jvm> (let [[capacity transform] (representation buffer)]
(|> (java/lang/StringBuilder::new (ffi.as_int (.int capacity)))
transform
java/lang/StringBuilder::toString
ffi.of_string))]
(for @.old <jvm>
@.jvm <jvm>
- @.js (let [[capacity transform] (:representation buffer)]
+ @.js (let [[capacity transform] (representation buffer)]
(|> (array.empty 0)
- (:as (JS_Array Text))
+ (as (JS_Array Text))
transform
(JS_Array::join "")))
- @.lua (let [[capacity transform] (:representation buffer)]
+ @.lua (let [[capacity transform] (representation buffer)]
(table/concat (transform (array.empty 0)) ""))
... default
(sequence#mix (function (_ chunk total)
(format total chunk))
""
- (:representation buffer)))))
+ (representation buffer)))))
))