| author | Alan Dipert
<alan@tailrecursion.com> 2026-07-16 02:23:18 UTC |
| committer | Alan Dipert
<alan@tailrecursion.com> 2026-07-16 02:23:18 UTC |
| parent | 053acc15048d0aab74188b0ca8b1d2bb9ff73c65 |
| md/Klong.md | +18 | -20 |
| tpl/style.css | +1 | -0 |
diff --git a/md/Klong.md b/md/Klong.md index 9a31f10..cd96858 100644 --- a/md/Klong.md +++ b/md/Klong.md @@ -1,25 +1,9 @@ # Klong - Created Wednesday 15 July 2026 -## J on an airplane - -Many years ago I learned [J](https://www.jsoftware.com/) on an airplane using an interpreter I found for the iPad. I relish long flights for this kind of thing. A few uninterrupted hours are enough to try a new language or paradigm. - -J impressed me with its array-oriented thinking and concision. A small expression could describe a whole computation without loops, indexes, or temporary variables. - -A few weeks later I understood why people sometimes call array languages "write only." The skill was remarkably perishable. What bothered me most was contextual operator overloading: a symbol could mean different things in different surroundings. Those distinctions were among the first things I forgot, and I never kept up with J. - -## Finding Klong - -About five years ago I found [Klong](https://t3x.org/klong/), [Nils M Holm](https://t3x.org/nmh/)'s small array language inspired by [K](https://en.wikipedia.org/wiki/K_(programming_language)). It had the dense expressions and whole-array operations I remembered liking. - -Klong also addressed my specific objection. Its syntax is unambiguous: fold, convergence, iteration, and looping have distinct spellings. Klong came with a clear [reference manual](https://t3x.org/klong/klong-ref.txt.html), Holm's book [*An Introduction to Array Programming in Klong*](https://t3x.org/klong/book.html), and a small, free C interpreter I could read and hack on. - -Then my family grew, and I had fewer long stretches for learning languages. I kept Klong in mind but rarely sat down with it. - ## Klong in a browser -Recently I realized I would use Klong more if it lived on both my phone and my computer. I did not need to port the interpreter. I could compile the C program to [WebAssembly](https://webassembly.org/) and run it in a [browser worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). So I built [Klong for the Web](https://tailrecursion.com/klong/). +I built [Klong for the Web](https://tailrecursion.com/klong/), a browser notebook for [Nils M Holm](https://t3x.org/nmh/)'s small array language. The interface works like a small [Jupyter](https://jupyter.org/) notebook: cells share interpreter state and can run individually or together. Notebooks persist locally, `.kg` files can be imported and exported, and the installed web app works offline. [](https://tailrecursion.com/klong/) @@ -32,8 +16,22 @@ prime::{&/x!:\2+!_x^1%2} prime(97) ``` -The site runs Holm's C interpreter, not a JavaScript reimplementation. A thin bridge feeds source files to it and captures its normal output. Execution happens in a dedicated worker, so stopping a runaway program does not freeze the page. +The site runs Holm's C interpreter, not a JavaScript reimplementation. I compiled it to [WebAssembly](https://webassembly.org/); a thin bridge feeds source files to it and captures its normal output. Execution happens in a dedicated [browser worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API), so stopping a runaway program does not freeze the page. There is no execution server or account. + +It is a practical companion to Holm's book, [*An Introduction to Array Programming in Klong*](https://t3x.org/klong/book.html): read a section, try the examples, change them, and keep the useful results in a notebook. + +## J on an airplane + +Many years ago I learned [J](https://www.jsoftware.com/) on an airplane using an interpreter I found for the iPad. I relish long flights for this kind of thing. A few uninterrupted hours are enough to try a new language or paradigm. + +J impressed me with its array-oriented thinking and concision. A small expression could describe a whole computation without loops, indexes, or temporary variables. + +A few weeks later I understood why people sometimes call array languages "write only." The skill was remarkably perishable. What bothered me most was contextual operator overloading: a symbol could mean different things in different surroundings. Those distinctions were among the first things I forgot, and I never kept up with J. + +## Finding Klong + +About five years ago I found [Klong](https://t3x.org/klong/), a small array language inspired by [K](https://en.wikipedia.org/wiki/K_(programming_language)). It had the dense expressions and whole-array operations I remembered liking. -The interface works like a small [Jupyter](https://jupyter.org/) notebook. Cells share interpreter state and can run individually or together. Notebooks persist locally, `.kg` files can be imported and exported, and the installed web app works offline. There is no execution server or account. +Klong also addressed my specific objection. Its syntax is unambiguous: fold, convergence, iteration, and looping have distinct spellings. Klong came with a clear [reference manual](https://t3x.org/klong/klong-ref.txt.html), Holm's book, and a small, free C interpreter I could read and hack on. -It is a practical companion to Holm's book: read a section, try the examples, change them, and keep the useful results in a notebook. I can do that from my phone or computer while running the real Klong interpreter. +Then my family grew, and I had fewer long stretches for learning languages. I kept Klong in mind but rarely sat down with it. Putting the interpreter in a browser gives me a way to use it from my phone or computer without first setting up a development environment. diff --git a/tpl/style.css b/tpl/style.css index 06f22f2..468e3f6 100644 --- a/tpl/style.css +++ b/tpl/style.css @@ -71,6 +71,7 @@ body{ .content code{background:#f7f7f7;} .content pre{padding:.75rem;overflow:auto;} a{color:var(--link);} +.content img{max-width:100%;height:auto;} img[src*="float_right"]{float:right;border-radius:.75em;} img[src*="200px"]{width:200px;} .level-one{background:#e6f7ff;color:#0b5394;padding:0 .25em;border-radius:.25em;}