take

From The K Language Wiki
Revision as of 06:14, 16 July 2021 by Razetime (talk | contribs) (add take page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Take
a#y

The take primitive takes a elements from a given list y.

Positive a takes elements from the beginning, and negative values will take from the end.

If a > #y(a is greater than y's length), y is repeated to that length.

 3#"abcde"
"abc"

 -3#"abcde"
"cde"

 5#,5
5 5 5 5 5