Re:Stages of denial in encountering K
by ehsankia on Monday March 09, 2020 @01:36AM
(#22523216)
range(100).reduce(plus, 0) isn't cryptic, what's cryptic is single character symbols. Looking at that line, unless you know K specifically, it's very difficult to figure out it's a reduce. Where as `sum(range(100))` is pretty self explanatory to most programmers who don't know python.
[ Parent
| on HN ]
Not to mention it's a lot easier to search for `reduce` than `+`.
I don't know K but "+/" immediately stood out to me as "add over", so I think they made a good choice in using "/" for fold.
"!", on the other hand...
There's no good (or bad) choices for mapping abstract concepts like ranges, mapping, reducing, or combining to common (ASCII-) symbols.
Every choice is inherently arbitrary and carries no meaning whatsoever (besides maybe ergonomics). One could just as well argue that "/" is the ISO 8000-2:2009 2-9.6 recommended symbol for division. The same source also shows why symbols alone are inadequate for an explicit representation of abstract concepts: the Nabla symbol alone represents 5 different operations depending on context according to the ISO standard.