git » homepage.git » commit 053acc1

Add Klong browser notebook article

author Alan Dipert
2026-07-16 02:15:24 UTC
committer Alan Dipert
2026-07-16 02:15:24 UTC
parent a6e868ab7c7e67586c6fbda583824ce3866b046a

Add Klong browser notebook article

md/Home.md +1 -0
md/Klong.md +39 -0
md/Klong/klong-prime.png +0 -0
md/Writings.md +3 -0
tools/build_page.py +2 -1

diff --git a/md/Home.md b/md/Home.md
index cf2611f..81af383 100644
--- a/md/Home.md
+++ b/md/Home.md
@@ -24,6 +24,7 @@ Updates
 
 | Date       | Note                                                                                                                                       |
 |:-----------|:-------------------------------------------------------------------------------------------------------------------------------------------|
+| 2026-07-15 | Added [Klong](./Klong.md), on returning to array programming by putting the real Klong interpreter in a browser notebook.                  |
 | 2026-05-15 | Added [ProgrammablePhones](./ProgrammablePhones.md), on AI coding agents making personal mobile software practical.                         |
 | 2026-02-24 | Added [GridCalc](./GridCalc.md), an RPN spreadsheet for iOS with a persistent, visible program grid.                                       |
 | 2026-01-07 | Added [ActorAgents](./ActorAgents.md), applying the actor model to agentic systems with explicit capabilities and limits.                   |
diff --git a/md/Klong.md b/md/Klong.md
new file mode 100644
index 0000000..9a31f10
--- /dev/null
+++ b/md/Klong.md
@@ -0,0 +1,39 @@
+# 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/).
+
+[![Klong for the Web running the compact prime-number test from the Klong website](./Klong/klong-prime.png)](https://tailrecursion.com/klong/)
+
+*The Klong interpreter checks that 97 is prime and returns 1.*
+
+The example comes from the Klong website:
+
+```klong
+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 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.
+
+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.
diff --git a/md/Klong/klong-prime.png b/md/Klong/klong-prime.png
new file mode 100644
index 0000000..1a015e6
Binary files /dev/null and b/md/Klong/klong-prime.png differ
diff --git a/md/Writings.md b/md/Writings.md
index d1ad39d..da85fc0 100644
--- a/md/Writings.md
+++ b/md/Writings.md
@@ -2,6 +2,9 @@
 
 I keep long-form pieces here when I want to explore a topic beyond a paragraph or status post.
 
+Programming
+- [Klong](./Klong.md) recounts my return to array programming and the browser notebook I built to keep the real interpreter close at hand.
+
 AI
 - [AIAndRisk](./AIAndRisk.md) weighs how AI shifts upside toward owners who can offload risk, while salaried engineers must keep understanding in their own heads.
 - [Coherence](./Coherence.md) explains how I use an AI coding agent like an employee by aligning intent, artifacts, and execution.
diff --git a/tools/build_page.py b/tools/build_page.py
index 63a1bde..4a26fac 100755
--- a/tools/build_page.py
+++ b/tools/build_page.py
@@ -207,11 +207,12 @@ def main() -> None:
             href = html.escape(f"{root_prefix}{rel_source[:-3]}.html", quote=True)
             display = html.escape(rel_source[:-3])
             items.append(f"<li><a href=\"{href}\">{display}</a></li>")
+        joined_items = "\n    ".join(items)
         backlinks_html = (
             '<div class="backlinks">\n'
             "  <h3>Backlinks</h3>\n"
             "  <ul>\n"
-            f"    {'\n    '.join(items)}\n"
+            f"    {joined_items}\n"
             "  </ul>\n"
             "</div>\n"
         )