4 ms·
Adding to RodgerTheGreat's comment: for me, k's power is its rich set of adverbs that are convenient to write. Notice that aside from reverse (monadic |), all
by chrispsn 2y ago
Adding to RodgerTheGreat's comment: for me, k's power is its rich set of adverbs that are convenient to write.
Notice that aside from reverse (monadic |), all verb symbols in the above code are in most other languages (max as |, min as &, plus as +, minus as -). Adverbs (such as / for reduce and \ for scan-reduce) make the symbols we already have more generally applicable.
I think a language could go a long way with a small set of basic arithmetic symbols alongside a rich set of adverb symbols.
- RodgerTheGreat 2y agoAnd perhaps further worth noting, the reason K uses dyadic & and | for minimum and maximum (respectively) is because logical AND and logical OR are identical to minimum and maximum if the arguments happen to be boolean (0/1). The notation and selection of primitives illustrate a useful and memorable symmetry.