Klong

tailrecursion.com · 2026-07-16 · by Long Nguyen ·generic

Klong

Klong

  • Created Wednesday 15 July 2026
  • Klong in a browser

    I built Klong for the Web, a browser notebook for Nils M Holm's small array language. The interface works like a small Jupyter 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.

    Klong for the Web running the compact prime-number test from the Klong website

    The Klong interpreter checks that 97 is prime and returns 1.

    The example comes from the Klong website:

    prime::{&/x!:\2+!_x^1%2}
    prime(97)

    The site runs Holm's C interpreter, not a JavaScript reimplementation. I compiled it to WebAssembly; a thin bridge feeds source files to it and captures its normal output. Execution happens in a dedicated browser worker, 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: 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 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, a small array language inspired by K. 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, Holm's book, 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. 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.

    Backlinks

  • Home
  • Writings
tailrecursion.com · 1 images · 14 links

Comments (0)

No comments yet