The following code creates a temporary Vector:
0.to(15).map(f).toArray
^^^^^^^^
Sequence
^^^^^^^^^^^^^^^
temp Vector
^^^^^^^^^^^^^^^^^^^^^^^
Array
The following code creates a temporary Array:
0.to(15).toArray.map(f)
^^^^^^^^
Sequence
^^^^^^^^^^^^^^^
temp Array
^^^^^^^^^^^^^^^^^^^^^^^
Array
Is there a way to map f over the Sequence and directly get an Array, without producing a temporary?