Array languages typically introduce a lot of ambiguity, which is intended, because it is common in mathematics and allows to recycle symbols and names for different purposes. It is also something that I have always disliked about math. Hence I invented Klong.
For instance, in K the expression f/x
may denote any
of the following, depending on the type of f
:
f
over x
f(x)
Similarly, x f/y
may denote:
f
over x,y
y:f(y)
while x(y)
y:f(y)
x
timesIm Klong, there is a unique adverb for each of those operations:
f/x |
fold f over x |
|
f:~x |
converge toward the fixpoint of f(x) |
|
x f/y |
fold f over x,y |
|
x f:~y |
set y::f(y) while x(y) |
|
x f:*y |
set y::f(y) x times |
The Converge and While adverbs are distingished by their context:
f:~
in a prefix position means Converge and in an infix
position it means While.
Similarly, Klong distinguishes between Drop (_
)
and Cut (:_
), Modulo (!
) and Rotate
(:+
), and Take (#
) and Reshape (:^
).
And, yes, some Klong operators look like smileys. :)