[q] -> [r] -> [(q, r)]
zip takes two lists and returns a list of corresponding pairs. If one input list is short, excess elements of the longer list are discarded.
O(n+m) Find all non-overlapping instances of needle in haystack. Each element of the returned list consists of a pair:
* The entire string prior to the kth match (i.e. the prefix)
* The kth match, followed by the remainder of the string
Examples:
> breakOnAll "::" ""
> ==> []
> breakOnAll "/" "a/b/c/"
> ==> [("a", "/b/c/"), ("a/b", "/c/"), ("a/b/c", "/")]
In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).
The needle parameter may not be empty.
O(n+m) Find all non-overlapping instances of needle in haystack. Each element of the returned list consists of a pair:
* The entire string prior to the kth match (i.e. the prefix)
* The kth match, followed by the remainder of the string
Examples:
> breakOnAll "::" ""
> ==> []
> breakOnAll "/" "a/b/c/"
> ==> [("a", "/b/c/"), ("a/b", "/c/"), ("a/b/c", "/")]
This function is strict in its first argument, and lazy in its second.
In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).
The needle parameter may not be empty.
generate list of labeled nodes
gmapT with accumulation
The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new ByteString.
The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new list.
The mapAccumR function behaves like a combination of map and foldr; it applies a function to each element of a ByteString, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new ByteString.
The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new ByteString.
The mapAccumL function behaves like a combination of map and foldl; it applies a function to each element of a ByteString, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new list.
The mapAccumR function behaves like a combination of map and foldr; it applies a function to each element of a ByteString, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new ByteString.
O(n) Like a combination of map and foldl'. Applies a function to each element of a Text, passing an accumulating parameter from left to right, and returns a final Text. Performs replacement on invalid scalar values.
The mapAccumR function behaves like a combination of map and a strict foldr; it applies a function to each element of a Text, passing an accumulating parameter from right to left, and returning a final value of this accumulator together with the new Text. Performs replacement on invalid scalar values.
Evaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value.
otherwise -> Just (length x) </pre>
For example, to tokenise a string, dropping delimiters:
> tokenise x y = h (:) if null t then [] else tokenise x (drop (length x) t)
>
To skip to the first occurence of a string:
> snd (breakSubstring x y)
To take the parts of a string before a delimiter:
> fst (breakSubstring x y)
O(n+m) Find the first instance of needle (which must be non-null) in haystack. The first element of the returned tuple is the prefix of haystack before needle is matched. The second is the remainder of haystack, starting with the match.
Examples:
> breakOn "::" "a::b::c" ==> ("a", "::b::c")
> breakOn "/" "foobar" ==> ("foobar", "")
Laws:
> append prefix match == haystack
>
If you need to break a string by a substring repeatedly (e.g. you want to break on every instance of a substring), use breakOnAll instead, as it has lower startup overhead.
In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).
O(n+m) Find the first instance of needle (which must be non-null) in haystack. The first element of the returned tuple is the prefix of haystack before needle is matched. The second is the remainder of haystack, starting with the match.
Examples:
> breakOn "::" "a::b::c" ==> ("a", "::b::c")
> breakOn "/" "foobar" ==> ("foobar", "")
Laws:
> append prefix match == haystack
>
If you need to break a string by a substring repeatedly (e.g. you want to break on every instance of a substring), use breakOnAll instead, as it has lower startup overhead.
This function is strict in its first argument, and lazy in its second.
In (unlikely) bad cases, this function's time complexity degrades towards O(n*m).
Show more results