3 ms·
The 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 o
by RodgerTheGreat 10y ago
The 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.