:: [char] -> [char] -> [char] -package:utility-ht

(++) appends two lists, i.e.,
[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
[x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list.

Performance considerations

This function takes linear time in the number of elements of the first list. Thus it is better to associate repeated applications of (++) to the right (which is the default behaviour): xs ++ (ys ++ zs) or simply xs ++ ys ++ zs, but not (xs ++ ys) ++ zs. For the same reason concat = foldr (++) [] has linear performance, while foldl (++) [] is prone to quadratic slowdown

Examples

>>> [1, 2, 3] ++ [4, 5, 6]
[1,2,3,4,5,6]
>>> [] ++ [1, 2, 3]
[1,2,3]
>>> [3, 2, 1] ++ []
[3,2,1]
tailDef [12] [] = [12]
tailDef [12] [1,3,4] = [3,4]
Append two lists, i.e.,
[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
[x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list. WARNING: This function takes linear time in the number of elements of the first list.
Append two lists, i.e.,
[x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
[x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list.
Fair 2-way interleaving.
Lazily interleaves two lists, switching between elements of the two. Union/sum of the elements in the lists.
[x,y,z,...] +| [a,b,c,...]  =  [x,a,y,b,z,c,...]
Tail function (safe). Returns a default list on empty lists. O(1).
init, safe. O(n).
merges elements from two lists into one list in an alternating way
interleave [0,1,2,3] [10,11,12,13] == [0,10,1,11,2,12,3,13]
(⧺) = (++) U+29FA, DOUBLE PLUS
Chooses between a compiled action and an interpreted action based on the configured default.
Nondeterministically choose between two computations.
(m <|> n) >>= k = (m >>= k) <|> (n >>= k)
(m <|> n) <|> o = m <|> (n <|> o)
empty <|> m = m
m <|> empty = m
Convenience function to catch FailedCommand Timeout exceptions and perform some action. Example:
waitUntil 5 (getText <=< findElem $ ByCSS ".class")
`onTimeout` return ""
O(m+n) Concatenate two vectors
Generalized version of finally. Note, any monadic side effects in m of the "afterward" computation will be discarded.
Generalized version of onException. Note, any monadic side effects in m of the "afterward" computation will be discarded.