October 19th, 2024

Stages of Denial

K is a closed-source programming language with cryptic syntax, allowing concise expressions but sacrificing readability. The author explores its potential and compares it to J and APL, discussing code clarity versus cleverness.

Read original articleLink Icon
Stages of Denial

The exploration of the programming language K reveals its unique characteristics and challenges. K is a closed-source language that employs cryptic syntax, making it difficult to read and understand compared to more conventional programming languages. The author reflects on the appeal of K's concise expressions, which can perform complex operations with minimal code. However, this brevity often comes at the cost of readability and maintainability, leading to a tension between cleverness and clarity in coding practices. The author also draws comparisons to other languages like J and APL, noting their similar right-to-left evaluation and mathematical capabilities. Despite the initial frustration with K's syntax, the author begins to appreciate its potential, considering the possibility of implementing K's primitives in a more familiar programming language. The discussion highlights the ongoing debate in programming communities about the balance between succinctness and comprehensibility, as well as the subjective nature of what constitutes "readable" code. Ultimately, the author grapples with the idea that while longer, more descriptive names can enhance understanding, they can also detract from the elegance of the code.

- K is a closed-source programming language known for its cryptic syntax.

- The language allows for concise expressions but sacrifices readability and maintainability.

- Comparisons are made to J and APL, which share similar features with K.

- The author considers the implementation of K's primitives in more conventional languages.

- The discussion reflects broader debates in programming about code clarity versus cleverness.

Link Icon 5 comments
By @msla - 6 months
My only "denial" when encountering high-church array languages is to deny them the precious brain space required to memorize their line noise syntax in order to be able to read them without a high ratio of comments to code.

They're (poorly) aping mathematical notation without the properties that give actual notations their power to augment thought using symbolic manipulation, but the people writing code in such languages don't see the need to write like mathematicians; to wit, they don't write mostly in English and save their code snippets for apposite moments when they would illuminate as opposed to obscure. Haskell programmers at least have the taste to use names in their code.

By @JadeNB - 6 months
Isn't the loop

    let max = list[0];
    for (let i = 0; i < list.length; i++) {
     max = Math.max(list[i], max);
    }
at the end just implementing the variadic `Math.max()` of JavaScript by pretending that it's binary? (I bring up JavaScript because the text seems to indicate that's the language in which the snippets are written: "You suggest an alternative, wincing slightly at the lambda notation you need to avoid running afoul of JavaScript’s variadic Math.max(): ….")
By @phoe-krk - 6 months
By @kstrauser - 6 months
Step 1: Huh, I wonder what some of those implementations look like?

Step 2: https://codeberg.org/ngn/k/src/branch/master/a.c

Step 3: Uh, I think I'm urgently needed elsewhere.