Algosim documentation: truncate

truncate

Truncates a linear container.

Syntax

Description

If X is a linear container, such as a string, a vector, a list, a structure, or a binary data object, then truncate(X, n) returns X truncated to its first n elements.

truncate(RandomVector(100), 5)
 ⎛0.232674886473 ⎞
 ⎜ 0.98901701835 ⎟
e⎜ 0.71893577138 ⎟
 ⎜0.0824703953695⎟
 ⎝0.584349762648 ⎠
truncate("Lorem ipsum dolor sit amet, consectetur adipiscing elit.", 11)
Lorem ipsum

See also