For: Difference between revisions

From The K Language Wiki
Content added Content deleted
("Add category")
("Add all appropriate categories to each verb")
 
Line 21: Line 21:


[[Category:Adverbs]]
[[Category:Adverbs]]
[[Category:Primitives]]

Latest revision as of 03:15, 9 July 2022

For
n f/y
n f\y

for and scan-for are adverbs that apply a monadic function to a given noun y n times.

For(/) produces a single value, the final value.

Scan-for(\) produces a list of all intermediate values.

 5{1_x}/!10
5 6 7 8 9

 5{1_x}\!10
(0 1 2 3 4 5 6 7 8 9
 1 2 3 4 5 6 7 8 9
 2 3 4 5 6 7 8 9
 3 4 5 6 7 8 9
 4 5 6 7 8 9
 5 6 7 8 9)