
Klong – a simple array language - nils-m-holm
http://t3x.org/klong/index.html
======
bshimmin
Several times, over the years, when I've looked at a new and challenging (to
me, in both cases) programming language I've thought, "If I put a day or two
of effort in, I'm sure I'd eventually be able to make sense of this." The few
times I've actually tried this, eg. with Haskell, I've been proven correct.

I've never felt the same confidence when looking at K - perhaps it really does
suddenly "click" if you just sit down and start trying to do something useful
with it, but right now, I really do just see gibberish. A couple of times I've
glanced at a K tutorial and I've been confused by about the second paragraph
(and not really able to commit any of the cryptic runes to memory). I
sincerely wonder whether if my career, or perhaps my life, depended on it, I
would suddenly find myself able to write and understand (!R)@&{&/x!/:2_!x}'!R
(I took that from the Wikipedia page; it may or may not just be line noise, I
can't tell).

Has anyone else experienced this and overcome it (with K, or something
similar)? It hardly matters to me since I'm unlikely ever to have to write K,
but it does make me wonder!

~~~
losvedir
Heh, I'm in a similar boat to you. I actually tweeted the other day[0]: "Ah,
APL/J/K. Time for my annual crisis of thinking everything I've ever learned
about programming is wrong...". It's so interesting to me that some people
claim fantastic productivity with it, while others find it completely
impenetrable. I've spent maybe a day or two trying to get over the initial
learning curve, but have never made significant progress.

On HN, geocar and beagle3 are both names that come to mind as proponents of
these types of languages and have very interesting comments. You could search
their name for more info, probably. There's a couple good breakdowns of code
here[1] and here[2].

[0]
[https://twitter.com/losvedir/status/636034419359289344](https://twitter.com/losvedir/status/636034419359289344)
[1]
[https://news.ycombinator.com/item?id=9120246](https://news.ycombinator.com/item?id=9120246)
[2]
[https://news.ycombinator.com/item?id=8476016](https://news.ycombinator.com/item?id=8476016)

~~~
RodgerTheGreat
If you're actually interested in diving in, here's a K5 repl you can use from
your browser:

[http://johnearnest.github.io/ok/index.html](http://johnearnest.github.io/ok/index.html)

There's a manual, and a guide to some programming techniques here:

[https://github.com/JohnEarnest/ok/blob/gh-
pages/docs/Manual....](https://github.com/JohnEarnest/ok/blob/gh-
pages/docs/Manual.md)

[https://github.com/JohnEarnest/ok/blob/gh-
pages/docs/Program...](https://github.com/JohnEarnest/ok/blob/gh-
pages/docs/Programming.md)

Examples and more discussion can be found in the same repo. This
implementation is "unofficial" (reverse-engineered) and quite slow compared to
the real thing, but it has a substantial portion of the functionality and is
quite usable for writing meaningful programs.

------
RodgerTheGreat
Very cool! I wrote (and am working on) a K interpreter in JavaScript called
"oK". Might be useful to compare notes:

[https://github.com/JohnEarnest/ok](https://github.com/JohnEarnest/ok)

I'll have a deeper look at Klong's implementation when I have time to see if
there are tricks worth borrowing.

~~~
nils-m-holm
Feel free to borrow whatever you need! Note though, that Klong is based on the
S9core toolkit[1] (included in the package), which might take some getting
used to.

[1] [http://www.t3x.org/s9fes/index.html](http://www.t3x.org/s9fes/index.html)

------
murbard2
Two disappointments I have with K/Q is that

1) functions that take multiple arguments break the pattern of concatenating
functions to build advanced expressions (yes, there is . but it's not nice to
use)

2) the right to left evaluation means you constantly have to go back to the
begin of the line to append functions

Both of these problems go away if you make it a stack based language with
postfix notation.

~~~
PeCaN
Coincidentally, a stack-based concatenative array language is exactly what I'm
working on right now.

It combines all the readability of K with... all the readability of Forth.

It's at [https://github.com/alpha123/vio](https://github.com/alpha123/vio) if
you're interested, but very much WIP. The VM is rather simple if you feel like
poking around.

Other notable features would be built-in parser combinators (with an
unreadable postfix regex-like syntax). Concatenative parser combinators are
pleasantly surprising to use.

~~~
chc4
It's be great if you had some examples to read through, or any documentation
really. Even a minimal README.

I'm interested in the idea, but without anything to go on it's pretty
impossible to look at.

~~~
PeCaN
Yeah sorry, it's a week old and I pushed it to GitHub just so I could link to
something in that comment ;)

Something of a README is now up.

------
scottlocklin
People who want to learn a useful and (more) easy to read K relative might
have a look at Kerf. It has the columnar database baked in.
[http://www.getkerf.com](http://www.getkerf.com)

------
chc4
A great article about K is
[http://archive.vector.org.uk/art10501320](http://archive.vector.org.uk/art10501320)
\- it introduces K as a magical, end-all programming language that is
blazingly fast and would solve lots of problems...if only someone other than
the author understood it.

As I understand it, the original K is closed-source and no one has really used
it. All the derivative languages were reverse-engineered from programs and
descriptions, and it spun into it's own family of APL-like languages. As far
as I know, at least.

