Appends another Cord
to the end of this one.
Appends another Cord
to the end of this one.
Time complexity: O(log (min N M)) where M and N are the lengths of the two Cord
s.
Prepends a String
to the beginning of this Cord
.
Prepends a String
to the beginning of this Cord
.
Time complexity: O(1)
Prepends a Char
to the beginning of this Cord
.
Prepends a Char
to the beginning of this Cord
.
Time complexity: O(1)
Appends a String
to the end of this Cord
.
Appends a String
to the end of this Cord
.
Time complexity: O(1)
Appends a Char
to the end of this Cord
.
Appends a Char
to the end of this Cord
.
Time complexity: O(1)
Returns the character at the given position.
Returns the character at the given position. Throws an error if the index is out of range. Time complexity: O(log N)
Removes the first n
characters from the front of this Cord
.
Removes the first n
characters from the front of this Cord
.
Time complexity: O(min N (N - n))
Transforms each character to a Cord
according to the given function and concatenates them all into one Cord
.
Removes the last character of this Cord
.
Removes the last character of this Cord
.
Time complexity: O(1)
Returns whether this Cord
will expand to an empty string.
Returns the number of characters in this Cord
.
Returns the number of characters in this Cord
.
Time complexity: O(1)
Modifies each character in this Cord
by the given function.
Modifies each character in this Cord
by the given function.
Time complexity: O(N)
Returns whether this Cord
will expand to a non-empty string.
Returns the number of characters in this Cord
.
Returns the number of characters in this Cord
.
Time complexity: O(1)
Splits this Cord
in two at the given position.
Splits this Cord
in two at the given position.
Time complexity: O(log N)
Removes the first character of this Cord
.
Removes the first character of this Cord
.
Time complexity: O(1)
Returns the first n
characters at the front of this Cord
.
Returns the first n
characters at the front of this Cord
.
Time complexity: O(min N (N - n))
A
Cord
is a purely functional data structure for efficiently storing and manipulatingString
s that are potentially very long. Very similar toRope[Char]
, but with better constant factors and a simpler interface since it's specialized forString
s.