WeSearch

Show HN: Larksson-lang: everything is a map or an atom

·1 min read · 0 reactions · 0 comments · 22 views
#programming#language#homoiconic
Show HN: Larksson-lang: everything is a map or an atom
TL;DR · WeSearch summary

Larksson-lang is a new homoiconic programming language where programs and data share the same structure. It operates on two types of values: integers and maps, eliminating the distinction between expressions and data. The language allows for dynamic program construction and execution by treating everything as a map.

Key facts
Original article
GitHub
Read full at GitHub →
Opening excerpt (first ~120 words) tap to expand

<name, formerly larksson> A small homoiconic language: programs and data have the same shape because they are the same thing. lines! .ops.add. = { args: { left: 2, right: 3 }, return: 0, trigger: 0 } .var.sum. = (.ops.add.return.) That runs 2 + 3, stores 5 in .var.sum., and dumps the final state of root. Three things to notice: add is a value with a particular shape, the assignment to a key called trigger is what causes computation to happen, and the result is read back through a path. Every operation works this way. The conceit There are exactly two kinds of values: integers and maps. Strings are maps from indices to character codes. Arrays are maps from indices to their elements. Paths are maps from indices to their components. Programs are maps from indices to statements.

Excerpt limited to ~120 words for fair-use compliance. The full article is at GitHub.

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Threads WhatsApp Bluesky Mastodon Email

Discussion

0 comments

More from GitHub