开发者打造维京诗歌编程语言 Hávamál

原标题:Show HN: Code like a Viking (Hávamál programming language)
42AI 研判分

开发者发布名为 Hávamál 的编程语言,程序需以古冰岛诗歌的韵律与头韵形式书写,灵感来自 APL 等串联式语言。该语言定位为 Advent of Code 类谜题的趣味解法,强调正确性之外的代码美感。

关联知识实体

报道正文

Advent of Code manages to nerd-snipe me almost every year, leading me to waste/enjoy a few hours.

The 2026 edition got me thinking that solving it is way too easy now with AI, which of course also takes all the fun out of it.

My solution to AoC 2026 day 1, star 1, in Hávamál.

I’m not exactly sure where the idea came from, but my next thought was, wouldn’t it be fun if there was a brand new puzzle language to write solutions in, where it’s not only a question of correctness but also of beauty? This “logically” led to the new language Hávamál, which is in ljóðháttur form (closer to modern Icelandic than to Old Norse), with alliteration (stuðlar og höfuðstafir) and a specific metre that must hold.

I had made an attempt a couple of years ago to get through at least some of AoC in a concatenative language (BQN) and more or less failed, but I thought it’d be fun this time to try another concatenative stack/box processing language, so Hávamál is inspired by APL and by Joy. There is also a simpler to write (closer to Joy) internal representation called Kjarni that you can write in before transposing to Hávamál.

You can write your own Hávamál programs, edit, debug and run them, in this online editor, or by running the code from the GitHub repo. No data leaves your browser.

There is a lot of freedom to choose the way you word things in Hávamál, but you also need to fit your implementation to the metre, with correct alliteration, and to the available Heiti (commands). Thus, you end up with a puzzle language: Solve the AoC (or similar) puzzle in code, find Heiti that alliterate, make it fit the metre, try to make it sound like wisdom from up on high.

I tried to ensure that most AoC style puzzles would be achievable without too much hassle in Hávamál, by verifying against my full set of solutions for AoC 2020. This led to a few language additions like priority queues named Dísir (in honor of Dijkstra, whose algorithm they are typicaly needed for), automatically memoized functions (e.g. “Eikarþáttur” is a function, “Eikarþáttur Munins” is that same function memoized), and bitwise operations (e.g. hamskipti for xor).

This art project is brought to you by me and Claude, courtesy of nerd-sniping by the friendly Christmas elves over at AoC.


作者发帖说明(HN):

A puzzle programming language where programs look like Hávamál, in the specific metre with alliteration required. Designed as a fun way to do Advent of Code style puzzles. Make it work, make it a poem, make it beautiful.