3 ms·
What do you gain from using the << syntax over a verbose but reasonably clear function name like "sorted-permutation"? Clarity in function names is one of the
by pmoriarty 10y ago
What do you gain from using the << syntax over a verbose but reasonably clear function name like "sorted-permutation"?
Clarity in function names is one of the main reasons I prefer Lisp and Scheme over languages like APL, K, and Haskell, which seem to favor the use of something like a mathematical notation, which I've always found obfuscating. This obfuscation is made worse by the aversion to comments that I've seen in some of these languages, while in Lisp and Scheme, the verbose and explicit function names are in a way self-documenting.
For someone who prefers a clear and explicit programming style, the terseness of some programming languages is a real turnoff.
- RodgerTheGreat 10y agoThe function "grade up" has the symbol "<". The composition of this function with itself "<<" is not a special case- it's "grade up of grade up". Compositions of functions are first-class objects in K, so you could certainly give it a name if you like (as well as eliding some of the brackets in the above example): ordinal: <<: (x,y,z)[ordinal g] "1a23z4z56b7c8d9" (x,y,z)ordinal g "1a23z4z56b7c8d9" The idiom << is common enough, though, that K programmers learn to recognize it when they see it in code. I'd have to look up the definition of "ordinal" to be certain it did what I think, but << is totally unambiguous. Contrary to your argument, naming short idioms like ,/ << +| and so on actually makes a program less explicit.
- deleted 10y ago[deleted]