Search documentation of jhn_stdlib

# jhn_blist (jhn_stdlib v5.10.3)

View Source

String Processing Functions for binary encoded strings.

This is a drop in replacement for the lists module in stdlib working on binaries interpreted as strings of octets in Latin1.

The module generates ref binaries as much as possible so if copies are more suitable apply binary/copy/1 on the result.

All functions in the stblib lists that would operate on tuples operate on equally sized octet blobs binaries.

# Summary

## Types

thing/0

## Functions

all(Pred, _)

Returns true if Pred(Elem) returns true for all elements Elem in String, otherwise false.

any(Pred, _)

Returns true if Pred(Elem) returns true for at least one element Elem in String.

append(Binaries)

Returns a String in which all the sub-strings of ListOfStrings have been appended.

append(Binary1, Binary2)

Returns a new list String3 which is made from the elements of String1 followed by the elements of String2.

concat(List)

Concatenates the text representation of the elements of Things. The elements of Things can be atoms, integers, floats, strings, or binaries.

delete(Elt, Binary)

Returns a copy of String1 where the first element matching Elem is deleted, if there is such an element.

droplast(Binary)

Drops the last element String1 from a non-empty string, otherwise function crashes.

dropwhile(Pred, Binary)

Drops elements Elem from String1 while Pred(Elem) returns true and returns the remaining string.

duplicate(N, Char)

Returns a string which contains N copies of the term Elem.

filter(Pred, Binary)

String2 is a string of all elements Elem in String1 for which Pred(Elem) returns true.

flatlength(IOList)

Equivalent to length(iolist_to_binary(DeepString)), but more efficient.

flatmap(Fun, Binary)

Takes a function from As to strings of Bs, and a string of As (String1) and produces a string of Bs by applying the function to every element in String1 and appending the resulting strings.

flatten(IOList)

Returns a flattened version of DeepString.

flatten(IOList, Binary)

Returns a flattened version of DeepString with the tail Tail appended.

foldl(Fun, Acc, _)

Calls Fun(Elem, AccIn) on successive elements A of String, starting with AccIn == Acc0. Fun/2 must return a new accumulator which is passed to the next call. The function returns the final value of the accumulator. Acc0 is returned if the string is empty.

foldr(Fun, Acc, Binary)

Like foldl/3, but the string is traversed from right to left.

foreach(Fun, _)

Calls Fun(Elem) for each element Elem in String. This function is used for its side effects and the evaluation order is defined to be the same as the order of the elements in the string.

keydelete(Key, N, Size, Binary)

Returns a copy of BlobSequence1 where the first occurrence of a blob whose Nth element compares equal to Key is deleted, if there is such a blob.

keyfind(Key, N, Size, Binary)

Searches the list of tuples BlobSequence for a tuple whose Nth element compares equal to Key. Returns Blob if such a tuple is found, otherwise false.

keymap(F, N, Size, Binary)

Returns a sequence of blobs where, for each blob in BlobSequence1, the Nth element Octet of the blob has been replaced with the result of calling Fun(Octet).

keymember(Key, N, Size, Binary)

Returns true if there is a blob in BlobSequence whose Nth element compares equal to Key, otherwise false.

keymerge(N, Size, Binary1, Binary2)

Returns the sorted binary formed by merging BlobSequence1 and BlobSequence2. The merge is performed on the Nth element of each blob. Both BlobSequence1 and BlobSequence2 must be key-sorted prior to evaluating this function. When two blobs compare equal, the blob from BlobSequence1 is picked before the tuple from BlobSequence2.

keyreplace(Key, N, Size, Binary, Item)

Returns a copy of BlobSequence1 where the first occurrence of a T blob whose Nth element compares equal to Key is replaced with NewBlob, if there is such a blob T.

keysearch(Key, N, Size, Binary)

Searches the sequence of blobs BlobSequence for a blob whose Nth element compares equal to Key. Returns {value, Blob} if such a blob is found, otherwise false.

keysort(N, Size, Binary)

Returns a binary containing the sorted elements of the blob sequence BlobSequence1. Sorting is performed on the Nth element of the blobs. The sort is stable.

keystore(Key, N, Size, Binary, Item)

Returns a copy of BlobSequence1 where the first occurrence of a blob T whose Nth element compares equal to Key is replaced with NewBlob, if there is such a tuple T. If there is no such blob T a copy of BlobSequence1 where NewBlob has been appended to the end is returned.

keytake(Key, N, Size, Binary)

Searches the sequence of blobs BlobSequence1 for a blob whose Nth element compares equal to Key. Returns {value, Blob, BlobSequence2} if such a tuple is found, otherwise false. BlobSequence2 is a copy of BlobSequence1 where the first occurrence of Blob has been removed.

last(Binary)

Returns the last octet in the binary.

map(F, Binary)

Takes a function from octets to octets, and a binary produces binary by applying the function to every octet in the binary. This function is used to obtain the return values. The evaluation order is implementation dependent.

mapfoldl(Fun, Acc, Binary)

mapfoldl combines the operations of map/2 and foldl/3 into one pass.

mapfoldr(Fun, Acc, Binary)

mapfoldr combines the operations of map/2 and foldr/3 into one pass

max(_)

Returns the first octet of the binary that compares greater than or equal to all other octets in the binary.

member(C, _)

Returns true if Elem matches some element of Binary, otherwise false.

merge3(B1, B2, B3)

Returns the sorted binary formed by merging Binary1, Binary2 and Binary3. All of Binary1, Binary2 and Binary3 must be sorted prior to evaluating this function. When two octets compare equal, the octet from Binary1, if there is such an octet, is picked before the other octet, otherwise the octet from Binary2 is picked before the octet from Binary3.

merge(Binaries)

Returns the sorted binary formed by merging all the sub-binaries of ListOfBinaries. All sub-binaries must be sorted prior to evaluating this function. When two octets compare equal, the octets from the sub-binary with the lowest position in ListOfBinaries is picked before the other octet.

merge(B1, B2)

Returns the sorted binary formed by merging Binary1 and Binary2. Both Binary1 and Binary2 must be sorted prior to evaluating this function. When two octets compare equal, the octet from Binary1 is picked before the octet from Binary2.

merge(Pred, B1, B2)

Returns the sorted binary formed by merging Binary1 and Binary2. Both Binary1 and Binary2 must be sorted according to the ordering function Fun prior to evaluating this function. Fun(A, B) should return true if A compares less than or equal to B in the ordering, false otherwise. When two octets compare equal, the octet from Binary1 is picked before the octet from Binary2.

min(_)

Returns the first octet of Binary that compares less than or equal to all other octets of Binary.

nth(Pos, Binary)

Returns the Nth octet of Binary. One based.

nthtail(Pos, Binary)

Returns the Nth tail of Binary, that is, the sub-binary of Binary starting at N+1 and continuing up to the end of the binary.

partition(Pred, Binary)

Partitions Binary into two binaries, where the first binary contains all octets for which Pred(Octet) returns true, and the second binary contains all octets for which Pred(Octet) returns false.

prefix(Binary1, Binary2)

Returns true if Binary1 is a prefix of Binary2, otherwise false.

reverse(_)

Returns a string with the elements in String1 in reverse order.

reverse(Binary, Tail)

Returns a string with the elements in String1 in reverse order, with the tail Tail appended.

seq(From, To)

Returns a sequence of integers which starts with From and contains the successive results of adding 1 to the previous element, until To has been reached number encompassed by the sequence. Wraps to zero when it reaches 255.

seq(From, To, Incr)

Returns a sequence of integers which starts with From and contains the successive results of adding Incr to the previous element, until To has been reached or passed (in the latter case, To is not an element of the sequence). Wraps to zero when it reaches 255.

sort(Binary)

Returns a binary containing the sorted octets of Binary1.

sort(Fun, Binary)

Returns a binary containing the sorted octets of Binary1, according to the ordering function Fun. Fun(A, B) should return true if A compares less than or equal to B in the ordering, false otherwise.

split(N, Binary)

Splits Binary1 into Binary2 and Binary3. Binary2 contains the first N octets and Binary3 the rest of the octets (the Nth tail).

splitwith(Pred, Binary)

Partitions Binary into two binaries according to Pred. splitwith/2 behaves as if it is defined as follows

sublist(Binary, Len)

Returns the sub-binary of Binary1 starting at position 1 and with (max) Len octets. It is not an error for Len to exceed the length of the binary, in that case the whole binary is returned.

sublist(Binary, Start, Len)

Returns the sub-binary of Binary1 starting at Start and with (max) Len octets. It is not an error for Start+Len to exceed the length of the binary.

subtract(Binary1, Binary2)

Returns a new binary Binary3 which is a copy of Binary1, subjected to the following procedure: for each octet in Binary2, its first occurrence in Binary1 is deleted.

suffix(Binary1, Binary2)

Returns true if Binary1 is a suffix of Binary2, otherwise false.

sum(Binary)

Returns the sum of the octets in binary.

takewhile(Pred, Binary)

Takes octet Octet from Binary1 while Pred(Octet) returns true, that is, the function returns the longest prefix of the binary for which all octets satisfy the predicate.

ukeymerge(N, Size, Binary1, Binary2)

Returns the sorted binary formed by merging BlobSequence1 and BlobSequence2. The merge is performed on the Nth octet of each blob. Both BlobSequence1 and BlobSequence2 must be key-sorted without duplicates prior to evaluating this function. When two blobs compare equal, the blob from BlobSequence1 is picked and the one from BlobSequence2 deleted.

ukeysort(N, Size, Binary)

Returns a binary containing the sorted octets of the binary BlobSequence1 where all but the first blob of the blobs comparing equal have been deleted. Sorting is performed on the Nth element of the blobs.

umerge3(B1, B2, B3)

Returns the sorted binary formed by merging Binary1, Binary2 and Binary3. All of Binary1, Binary2 and Binary3 must be sorted and contain no duplicates prior to evaluating this function. When two octets compare equal, the octet from Binary1 is picked if there is such an octet, otherwise the octet from Binary2 is picked, and the other one deleted.

umerge(Binaries)

Returns the sorted binary formed by merging all the sub-binaries of ListOfBinaries. All sub-binaries must be sorted and contain no duplicates prior to evaluating this function. When two elements compare equal, the element from the sub-binaries with the lowest position in ListOfBinaries is picked and the other one deleted.

umerge(B1, B2)

Returns the sorted binary formed by merging Binary1 and Binary2. Both Binary1 and Binary2 must be sorted and contain no duplicates prior to evaluating this function. When two octets compare equal, the octet from Binary1 is picked and the one from Binary2 deleted.

umerge(Pred, B1, B2)

Returns the sorted binary formed by merging Binary1 and Binary2. Both Binary1 and Binary2 must be sorted according to the ordering function Fun and contain no duplicates prior to evaluating this function. Fun(A, B) should return true if A compares less than or equal to B in the ordering, false otherwise. When two octets compare equal, the octet from Binary1 is picked and the one from Binary2 deleted.

unzip3(Binary)

"Unzips" a binary of three octet blobs into three binarys, where the first binary contains the first octet of each blob, the second binary contains the second octet of each blob, and the third binary contains the third octet of each blob.

unzip(Binary)

"Unzips" a binary of two octet blobs into two binarys, where the first binary contains the first octet of each blob, and the second binary contains the second octet of each blob.

usort(Binary)

Returns a binary containing the sorted octets of Binary1 where all but the first octet of the octets comparing equal have been deleted.

usort(Fun, Binary)

Returns a binary which contains the sorted octets of Binary1 where all but the first octet of the octets comparing equal according to the ordering function Fun have been deleted. Fun(A, B) should return true if A compares less than or equal to B in the ordering, false otherwise.

zip3(Binary1, Binary2, Binary3)

"Zips" three binaries of equal length into one binary of three-blobs, where the first octet of each blob is taken from the first binary, the second octet is taken from corresponding octet in the second binary, and the third octet is taken from the corresponding octet in the third binary.

zip(Binary1, Binary2)

"Zips" two binaries of equal length into one binary of two-blobs, where the first octet of each blob is taken from the first binary and the second octet is taken from corresponding octet in the second binary.

zipwith3(Fun, Binary1, Binary2, Binary3)

Combine the octets of three binarys of equal length into one binary. For each triple X, Y, Z of binary octets from the thre binarys, the binary in the result binary will be Combine(X, Y, Z).

zipwith(Fun, Binary1, Binary2)

Combine the octets of two binarys of equal length into one binary. For each pair X, Y of binary octets from the two binarys, the binary in the result binary will be Combine(X, Y).

# Types

# thing/0

    -type thing() :: atom() | integer() | float() | string() | binary().

# Functions

# all(Pred, _)

    -spec all(fun((byte()) -> boolean()), binary()) -> boolean().

Returns true if Pred(Elem) returns true for all elements Elem in String, otherwise false.

# any(Pred, _)

    -spec any(fun((byte()) -> boolean()), binary()) -> boolean().

Returns true if Pred(Elem) returns true for at least one element Elem in String.

# append(Binaries)

    -spec append([binary()]) -> binary().

Returns a String in which all the sub-strings of ListOfStrings have been appended.

# append(Binary1, Binary2)

    -spec append(binary(), binary()) -> binary().

Returns a new list String3 which is made from the elements of String1 followed by the elements of String2.

# concat(List)

    -spec concat([thing()]) -> binary().

Concatenates the text representation of the elements of Things. The elements of Things can be atoms, integers, floats, strings, or binaries.

# delete(Elt, Binary)

    -spec delete(char(), binary()) -> binary().

Returns a copy of String1 where the first element matching Elem is deleted, if there is such an element.

# droplast(Binary)

    -spec droplast(binary()) -> binary().

Drops the last element String1 from a non-empty string, otherwise function crashes.

# dropwhile(Pred, Binary)

    -spec dropwhile(fun((byte()) -> boolean()), binary()) -> binary().

Drops elements Elem from String1 while Pred(Elem) returns true and returns the remaining string.

# duplicate(N, Char)

    -spec duplicate(pos_integer(), byte()) -> binary().

Returns a string which contains N copies of the term Elem.

# filter(Pred, Binary)

    -spec filter(fun((byte()) -> boolean()), binary()) -> binary().

String2 is a string of all elements Elem in String1 for which Pred(Elem) returns true.

# flatlength(IOList)

    -spec flatlength(iolist()) -> non_neg_integer().

Equivalent to length(iolist_to_binary(DeepString)), but more efficient.

# flatmap(Fun, Binary)

    -spec flatmap(fun((byte()) -> binary()), binary()) -> binary().

Takes a function from As to strings of Bs, and a string of As (String1) and produces a string of Bs by applying the function to every element in String1 and appending the resulting strings.

# flatten(IOList)

    -spec flatten(iolist()) -> binary().

Returns a flattened version of DeepString.

# flatten(IOList, Binary)

    -spec flatten(iolist(), binary()) -> binary().

Returns a flattened version of DeepString with the tail Tail appended.

# foldl(Fun, Acc, _)

    -spec foldl(fun((byte(), Acc) -> Acc), Acc, binary()) -> Acc.

Calls Fun(Elem, AccIn) on successive elements A of String, starting with AccIn == Acc0. Fun/2 must return a new accumulator which is passed to the next call. The function returns the final value of the accumulator. Acc0 is returned if the string is empty.

# foldr(Fun, Acc, Binary)

    -spec foldr(fun((byte(), Acc) -> Acc), Acc, binary()) -> Acc.

Like foldl/3, but the string is traversed from right to left.

# foreach(Fun, _)

    -spec foreach(fun((byte()) -> _), binary()) -> ok.

Calls Fun(Elem) for each element Elem in String. This function is used for its side effects and the evaluation order is defined to be the same as the order of the elements in the string.

# keydelete(Key, N, Size, Binary)

    -spec keydelete(byte(), pos_integer(), pos_integer(), binary()) -> binary().

Returns a copy of BlobSequence1 where the first occurrence of a blob whose Nth element compares equal to Key is deleted, if there is such a blob.

# keyfind(Key, N, Size, Binary)

    -spec keyfind(byte(), pos_integer(), pos_integer(), binary()) -> binary() | false.

Searches the list of tuples BlobSequence for a tuple whose Nth element compares equal to Key. Returns Blob if such a tuple is found, otherwise false.

# keymap(F, N, Size, Binary)

    -spec keymap(fun((byte()) -> byte()), pos_integer(), pos_integer(), binary()) -> binary().

Returns a sequence of blobs where, for each blob in BlobSequence1, the Nth element Octet of the blob has been replaced with the result of calling Fun(Octet).

# keymember(Key, N, Size, Binary)

    -spec keymember(byte(), pos_integer(), pos_integer(), binary()) -> boolean().

Returns true if there is a blob in BlobSequence whose Nth element compares equal to Key, otherwise false.

# keymerge(N, Size, Binary1, Binary2)

    -spec keymerge(pos_integer(), pos_integer(), binary(), binary()) -> binary().

Returns the sorted binary formed by merging BlobSequence1 and BlobSequence2. The merge is performed on the Nth element of each blob. Both BlobSequence1 and BlobSequence2 must be key-sorted prior to evaluating this function. When two blobs compare equal, the blob from BlobSequence1 is picked before the tuple from BlobSequence2.

# keyreplace(Key, N, Size, Binary, Item)

    -spec keyreplace(byte(), pos_integer(), pos_integer(), binary(), binary()) -> binary().

Returns a copy of BlobSequence1 where the first occurrence of a T blob whose Nth element compares equal to Key is replaced with NewBlob, if there is such a blob T.

# keysearch(Key, N, Size, Binary)

    -spec keysearch(byte(), pos_integer(), pos_integer(), binary()) -> {value, binary()} | false.

Searches the sequence of blobs BlobSequence for a blob whose Nth element compares equal to Key. Returns {value, Blob} if such a blob is found, otherwise false.

# keysort(N, Size, Binary)

    -spec keysort(pos_integer(), pos_integer(), binary()) -> binary().

Returns a binary containing the sorted elements of the blob sequence BlobSequence1. Sorting is performed on the Nth element of the blobs. The sort is stable.

# keystore(Key, N, Size, Binary, Item)

    -spec keystore(byte(), pos_integer(), pos_integer(), binary(), binary()) -> binary().

Returns a copy of BlobSequence1 where the first occurrence of a blob T whose Nth element compares equal to Key is replaced with NewBlob, if there is such a tuple T. If there is no such blob T a copy of BlobSequence1 where NewBlob has been appended to the end is returned.

# keytake(Key, N, Size, Binary)

    -spec keytake(byte(), pos_integer(), pos_integer(), binary()) -> {value, binary(), binary()} | false.

Searches the sequence of blobs BlobSequence1 for a blob whose Nth element compares equal to Key. Returns {value, Blob, BlobSequence2} if such a tuple is found, otherwise false. BlobSequence2 is a copy of BlobSequence1 where the first occurrence of Blob has been removed.

# last(Binary)

    -spec last(binary()) -> byte().

Returns the last octet in the binary.

# map(F, Binary)

    -spec map(fun((byte()) -> byte()), binary()) -> binary().

Takes a function from octets to octets, and a binary produces binary by applying the function to every octet in the binary. This function is used to obtain the return values. The evaluation order is implementation dependent.

# mapfoldl(Fun, Acc, Binary)

    -spec mapfoldl(fun((byte(), Acc) -> {byte(), Acc}), Acc, binary()) -> {binary(), Acc}.

mapfoldl combines the operations of map/2 and foldl/3 into one pass.

# mapfoldr(Fun, Acc, Binary)

    -spec mapfoldr(fun((byte(), Acc) -> {byte(), Acc}), Acc, binary()) -> {binary(), Acc}.

mapfoldr combines the operations of map/2 and foldr/3 into one pass

# max(_)

    -spec max(binary()) -> byte().

Returns the first octet of the binary that compares greater than or equal to all other octets in the binary.

# member(C, _)

    -spec member(char(), binary()) -> boolean().

Returns true if Elem matches some element of Binary, otherwise false.

# merge3(B1, B2, B3)

    -spec merge3(binary(), binary(), binary()) -> binary().

Returns the sorted binary formed by merging Binary1, Binary2 and Binary3. All of Binary1, Binary2 and Binary3 must be sorted prior to evaluating this function. When two octets compare equal, the octet from Binary1, if there is such an octet, is picked before the other octet, otherwise the octet from Binary2 is picked before the octet from Binary3.

# merge(Binaries)

    -spec merge([binary()]) -> binary().

Returns the sorted binary formed by merging all the sub-binaries of ListOfBinaries. All sub-binaries must be sorted prior to evaluating this function. When two octets compare equal, the octets from the sub-binary with the lowest position in ListOfBinaries is picked before the other octet.

# merge(B1, B2)

    -spec merge(binary(), binary()) -> binary().

Returns the sorted binary formed by merging Binary1 and Binary2. Both Binary1 and Binary2 must be sorted prior to evaluating this function. When two octets compare equal, the octet from Binary1 is picked before the octet from Binary2.

# merge(Pred, B1, B2)

    -spec merge(fun((byte(), byte()) -> boolean()), binary(), binary()) -> binary().

Returns the sorted binary formed by merging Binary1 and Binary2. Both Binary1 and Binary2 must be sorted according to the ordering function Fun prior to evaluating this function. Fun(A, B) should return true if A compares less than or equal to B in the ordering, false otherwise. When two octets compare equal, the octet from Binary1 is picked before the octet from Binary2.

# min(_)

    -spec min(binary()) -> byte().

Returns the first octet of Binary that compares less than or equal to all other octets of Binary.

# nth(Pos, Binary)

    -spec nth(pos_integer(), binary()) -> byte().

Returns the Nth octet of Binary. One based.

# nthtail(Pos, Binary)

    -spec nthtail(pos_integer(), binary()) -> binary().

Returns the Nth tail of Binary, that is, the sub-binary of Binary starting at N+1 and continuing up to the end of the binary.

# partition(Pred, Binary)

    -spec partition(fun((byte()) -> boolean()), binary()) -> {binary(), binary()}.

Partitions Binary into two binaries, where the first binary contains all octets for which Pred(Octet) returns true, and the second binary contains all octets for which Pred(Octet) returns false.

# prefix(Binary1, Binary2)

    -spec prefix(binary(), binary()) -> boolean().

Returns true if Binary1 is a prefix of Binary2, otherwise false.

# reverse(_)

    -spec reverse(binary()) -> binary().

Returns a string with the elements in String1 in reverse order.

# reverse(Binary, Tail)

    -spec reverse(binary(), binary()) -> binary().

Returns a string with the elements in String1 in reverse order, with the tail Tail appended.

# seq(From, To)

    -spec seq(byte(), byte()) -> binary().

Returns a sequence of integers which starts with From and contains the successive results of adding 1 to the previous element, until To has been reached number encompassed by the sequence. Wraps to zero when it reaches 255.

# seq(From, To, Incr)

    -spec seq(byte(), byte(), byte()) -> binary().

Returns a sequence of integers which starts with From and contains the successive results of adding Incr to the previous element, until To has been reached or passed (in the latter case, To is not an element of the sequence). Wraps to zero when it reaches 255.

# sort(Binary)

    -spec sort(binary()) -> binary().

Returns a binary containing the sorted octets of Binary1.

# sort(Fun, Binary)

    -spec sort(fun((byte(), byte()) -> boolean()), binary()) -> binary().

Returns a binary containing the sorted octets of Binary1, according to the ordering function Fun. Fun(A, B) should return true if A compares less than or equal to B in the ordering, false otherwise.

# split(N, Binary)

    -spec split(non_neg_integer(), binary()) -> {binary(), binary()}.

Splits Binary1 into Binary2 and Binary3. Binary2 contains the first N octets and Binary3 the rest of the octets (the Nth tail).

# splitwith(Pred, Binary)

    -spec splitwith(fun((byte()) -> boolean()), binary()) -> {binary(), binary()}.

Partitions Binary into two binaries according to Pred. splitwith/2 behaves as if it is defined as follows:

splitwith(Pred, Binary) -> {takewhile(Pred, Binary), dropwhile(Pred, Binary)}.

# sublist(Binary, Len)

    -spec sublist(binary(), pos_integer()) -> binary().

Returns the sub-binary of Binary1 starting at position 1 and with (max) Len octets. It is not an error for Len to exceed the length of the binary, in that case the whole binary is returned.

# sublist(Binary, Start, Len)

    -spec sublist(binary(), pos_integer(), pos_integer()) -> binary().

Returns the sub-binary of Binary1 starting at Start and with (max) Len octets. It is not an error for Start+Len to exceed the length of the binary.

# subtract(Binary1, Binary2)

    -spec subtract(binary(), binary()) -> binary().

Returns a new binary Binary3 which is a copy of Binary1, subjected to the following procedure: for each octet in Binary2, its first occurrence in Binary1 is deleted.

# suffix(Binary1, Binary2)

    -spec suffix(binary(), binary()) -> boolean().

Returns true if Binary1 is a suffix of Binary2, otherwise false.

# sum(Binary)

    -spec sum(binary()) -> integer().

Returns the sum of the octets in binary.

# takewhile(Pred, Binary)

    -spec takewhile(fun((byte()) -> boolean()), binary()) -> binary().

Takes octet Octet from Binary1 while Pred(Octet) returns true, that is, the function returns the longest prefix of the binary for which all octets satisfy the predicate.

# ukeymerge(N, Size, Binary1, Binary2)

    -spec ukeymerge(pos_integer(), pos_integer(), binary(), binary()) -> binary().

Returns the sorted binary formed by merging BlobSequence1 and BlobSequence2. The merge is performed on the Nth octet of each blob. Both BlobSequence1 and BlobSequence2 must be key-sorted without duplicates prior to evaluating this function. When two blobs compare equal, the blob from BlobSequence1 is picked and the one from BlobSequence2 deleted.

# ukeysort(N, Size, Binary)

    -spec ukeysort(pos_integer(), pos_integer(), binary()) -> binary().

Returns a binary containing the sorted octets of the binary BlobSequence1 where all but the first blob of the blobs comparing equal have been deleted. Sorting is performed on the Nth element of the blobs.

# umerge3(B1, B2, B3)

    -spec umerge3(binary(), binary(), binary()) -> binary().

Returns the sorted binary formed by merging Binary1, Binary2 and Binary3. All of Binary1, Binary2 and Binary3 must be sorted and contain no duplicates prior to evaluating this function. When two octets compare equal, the octet from Binary1 is picked if there is such an octet, otherwise the octet from Binary2 is picked, and the other one deleted.

# umerge(Binaries)

    -spec umerge([binary()]) -> binary().

Returns the sorted binary formed by merging all the sub-binaries of ListOfBinaries. All sub-binaries must be sorted and contain no duplicates prior to evaluating this function. When two elements compare equal, the element from the sub-binaries with the lowest position in ListOfBinaries is picked and the other one deleted.

# umerge(B1, B2)

    -spec umerge(binary(), binary()) -> binary().

Returns the sorted binary formed by merging Binary1 and Binary2. Both Binary1 and Binary2 must be sorted and contain no duplicates prior to evaluating this function. When two octets compare equal, the octet from Binary1 is picked and the one from Binary2 deleted.

# umerge(Pred, B1, B2)

    -spec umerge(fun((byte(), byte()) -> boolean()), binary(), binary()) -> binary().

Returns the sorted binary formed by merging Binary1 and Binary2. Both Binary1 and Binary2 must be sorted according to the ordering function Fun and contain no duplicates prior to evaluating this function. Fun(A, B) should return true if A compares less than or equal to B in the ordering, false otherwise. When two octets compare equal, the octet from Binary1 is picked and the one from Binary2 deleted.

# unzip3(Binary)

    -spec unzip3(binary()) -> {binary(), binary(), binary()}.

"Unzips" a binary of three octet blobs into three binarys, where the first binary contains the first octet of each blob, the second binary contains the second octet of each blob, and the third binary contains the third octet of each blob.

# unzip(Binary)

    -spec unzip(binary()) -> {binary(), binary()}.

"Unzips" a binary of two octet blobs into two binarys, where the first binary contains the first octet of each blob, and the second binary contains the second octet of each blob.

# usort(Binary)

    -spec usort(binary()) -> binary().

Returns a binary containing the sorted octets of Binary1 where all but the first octet of the octets comparing equal have been deleted.

# usort(Fun, Binary)

    -spec usort(fun((byte(), byte()) -> boolean()), binary()) -> binary().

Returns a binary which contains the sorted octets of Binary1 where all but the first octet of the octets comparing equal according to the ordering function Fun have been deleted. Fun(A, B) should return true if A compares less than or equal to B in the ordering, false otherwise.

# zip3(Binary1, Binary2, Binary3)

    -spec zip3(binary(), binary(), binary()) -> binary().

"Zips" three binaries of equal length into one binary of three-blobs, where the first octet of each blob is taken from the first binary, the second octet is taken from corresponding octet in the second binary, and the third octet is taken from the corresponding octet in the third binary.

# zip(Binary1, Binary2)

    -spec zip(binary(), binary()) -> binary().

"Zips" two binaries of equal length into one binary of two-blobs, where the first octet of each blob is taken from the first binary and the second octet is taken from corresponding octet in the second binary.

# zipwith3(Fun, Binary1, Binary2, Binary3)

    -spec zipwith3(fun((byte(), byte(), byte()) -> binary()), binary(), binary(), binary()) -> binary().

Combine the octets of three binarys of equal length into one binary. For each triple X, Y, Z of binary octets from the thre binarys, the binary in the result binary will be Combine(X, Y, Z).

`zipwith(fun(X, Y, Z) -> <<X, Y, Z>> end, Binary1, Binary2, Binary3)` is equivalent to zip(Binary1, Binary2. Binary3).

# zipwith(Fun, Binary1, Binary2)

    -spec zipwith(fun((byte(), byte()) -> binary()), binary(), binary()) -> binary().

Combine the octets of two binarys of equal length into one binary. For each pair X, Y of binary octets from the two binarys, the binary in the result binary will be Combine(X, Y).

`zipwith(fun(X, Y) -> <<X, Y>> end, Binary1, Binary2)` is equivalent to zip(Binary1, Binary2).