concat

Concats everything together using best effort.

It will concat as long as there is a common type between all sets of inputs. When an input is a range it will use ElementType as it's type.

If the first input is a string, all subsequent inputs are converted to a string as well

concat
(
Values...
)
(
Values values
)
if (
from!"bolts.traits".areCombinable!Values
)

Parameters

values
Type: Values

set of values that share a common type.

Return Value

Type: auto

A range of common type or a string if the first value is a string

Benchmarks: Bottom line, concat (which uses a static foreach) is faster than eager and recursive approach both with and without .array.

If you are dealing only with pure strings, however, then appender is your friend

1 Benchmarking concat against eager, recursive, and standard lib
2 the (array) versions involve a call to .array
3 concat single arguments:
4   concat:                1 hnsec
5   concatRecurse:         5 ms, 921 μs, and 6 hnsecs
6   concatEager:           5 ms, 417 μs, and 5 hnsecs
7   concat        (array): 1 ms and 372 μs
8   concatRecurse (array): 7 ms, 587 μs, and 2 hnsecs
9   concatEager   (array): 5 ms, 968 μs, and 2 hnsecs
10 concat multiple ranges together
11   concat:                1 ms, 491 μs, and 3 hnsecs
12   concatRecurse:         2 ms, 195 μs, and 3 hnsecs
13   concatEager:           7 ms, 787 μs, and 2 hnsecs
14   concat        (array): 3 ms, 174 μs, and 2 hnsecs
15   concatRecurse (array): 2 ms, 816 μs, and 7 hnsecs
16   concatEager   (array): 6 ms, 838 μs, and 1 hnsec
17 concat single args and multiple ranges:
18   concat:                1 ms, 858 μs, and 1 hnsec
19   concatRecurse:         3 ms, 479 μs, and 2 hnsecs
20   concatEager:           7 ms, 374 μs, and 9 hnsecs
21   concat        (array): 3 ms, 358 μs, and 5 hnsecs
22   concatRecurse (array): 5 ms, 558 μs, and 1 hnsec
23   concatEager   (array): 6 ms, 997 μs, and 3 hnsecs
24 concat strings and chars:
25   concat:                 0 hnsecs
26   concatRecurse:          1 ms, 368 μs, and 8 hnsecs
27   concat         (array): 4 ms, 238 μs, and 3 hnsecs
28   concatRecurse  (array): 5 ms, 77 μs, and 9 hnsecs
29 concat strings vs appender and join
30   concat:                 0 hnsecs
31   join:                   6 ms, 930 μs, and 4 hnsecs
32   appender:               3 ms, 186 μs, and 1 hnsec
33   concat    (array):      4 ms, 917 μs, and 6 hnsecs
34   join      (array):      9 ms, 243 μs, and 7 hnsecs
35   appender  (array):      3 ms, 57 μs, and 8 hnsecs

Meta

Since

0.0.1