Take: Difference between revisions

From The K Language Wiki
Content added Content deleted
("Remove lowercase again - it is in the template now")
Tag: Manual revert
("Better category ordering, add redirects to categories, fix pseudo-adverb categories")
 
(2 intermediate revisions by the same user not shown)
Line 17: Line 17:
5 5 5 5 5
5 5 5 5 5
</pre>
</pre>

[[Category:Verbs]]
[[Category:Operator verbs]]
[[Category:Primitives]]

Latest revision as of 06:42, 9 July 2022

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