Re:Learning K programming: idiom by idiom [pdf]
by RodgerTheGreat on Sunday May 12, 2024 @08:34PM
(#40338670)
if you insist on verbose names, they're always an option in K:
[ Parent
| on HN ]
Re:Learning K programming: idiom by idiom [pdf]
by chrispsn on Sunday May 12, 2024 @08:52PM
(#40338777)
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.
Re:Learning K programming: idiom by idiom [pdf]
by RodgerTheGreat on Sunday May 12, 2024 @09:19PM
(#40338945)
And 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.