K notebooks

This part of the capsule houses my K notebooks. It is powered by kral, my lightweight sort-of alternative to Jupyter Notebooks.

Exoplanet HAT-P-5b, a 'hot Jupiter' in the constellation of Lyra; an ancient Slovak term for the planet Jupiter.

Example notebook View the kral Git repository

kral exclusively uses the Gemini protocol and the K programming language. kral parses .kn notebooks and evaluates embedded K code. It then outputs Gemtext with the results embedded into the page.

K code is delimited by three pipes (looks like Ⅲ). These can be on their own lines, enclosing a block of code, or inline. For example, Ⅲ-1*|!9Ⅲ outputs (-8 -7 -6 -5 -4 -3 -2 -1 0). It's not the prettiest or tersest delimiter, but given that K not only uses but overloads every ASCII character, it was quite hard to find something suitably unlikely to appear in the code being evaluated. Ⅲ was chosen as it is equivalent to | in both the monadic and dyadic cases (I think), so it is unlikely to be used in K code. I'm also fairly sure that | can't occur at the end of a K expression (other than in a comment), so it should be easy to distinguish the ending delimiter from the code preceding it.

K? Gemini? Huh?

Gemini is a lightweight alternative to HTTP, but not quite as lightweight as Gopher. But if you're viewing this, you probably already knew that.

The Gemini protocol

K is an array-based programming language descended from APL. Originally developed by computer scientist Arthur Whitney, it has found a niche in finance, but has traditionally remained closed-source and prohibitively expensive. kral uses ngn/k, an open-source implementation of K6.


But why would you do this?

Partly to teach myself K, but mainly because it was fun.