,/:~
(Join Over Converging) flattens a list in Klong.Klong is simple, because its syntax is very regular. In K, many symbols are overloaded, so their meaning can only be deduced when knowing the types of their operands. In Klong, the syntax is unambiguous. See http://t3x.org/klong/ambiguity.html
Regarding precedence rules: there are none. Everything evaluates from the right to the left (as in K or APL).
The only reason you find the c-style version simpler is because that's what you are used to. But while you have been able to interpret the Klong expression with no experience at all, ask yourself if someone familiar with array languages (and only array languages) would be able to understand the c-style version in a few minutes without having to read an extensive tutorial.
I do not agree simplicity is in the eyes of the beholder. If a language can be totally specified by a few paragraphs and a table, it is simpler than a language that needs a long specification. However, this does not mean the simpler language is simpler to use. That, indeed, is a subjective matter.
Well, yes. But we're taught infix notation early (x+y), and function application quite early too (y=f(x) - and in combiation (also note short-hand eliding multiplication): f(x) = 2x + 1).
I still find array languages to be too dense for me - but I do understand that they are simple from a certain point of view.
f(x)=2x+1
In Q is
f:{1+2*x}
You could call it with: f 5 or f[5]. It’s really not any different.
Otoh, I'm still considering working through advent of code - such domains should be well suited, I guess.
For advent of code, it really shines though. Read in some big chunk of data, do a bunch of matrix and list operations to get the answer.
To be clear, a little language pride is always warranted :-)
Other than that, I find it a bit funny that the factorial function is singled out as an example of why naming (short) functions are redundant - seeing as how it's one of the first "complex" functions/operands thaught/named in mathematics, and heavily used to shorten notation for for example combinatorics (that is "n!").
But I think this just reflects on the (for me) somewhat alien culture of array languages - its not wrong, but it is different.
{&/x!:\2+!_x^1%2}
This is function that checks if the value given as first parameter x is a prime by running through the numbers 2 to square root of x and applying the function x modulus y, then it looks at the minimum of the resulting list and see if it is 1 or 0. If it is one then x is a prime.
Written in a language with c-style syntax it would be something like:
x -> min((2 .. sqrt(x)).map(y -> x % y)) == 1
Why is Klong simple?
Is it easier to implement, parse and interpretate?
Or is the syntax somehow simpler once you get used to it?
The former maybe; but it doesn't seem to be a part of the language's pitch.
The latter is surely in the eyes of the beholder. I find it counter-intuitive to have so many single character operators & ! : _ with uncommon meaning and precedence rules.