HeadlinesBriefing favicon HeadlinesBriefing.com

Why Janet? A Lisp Dialect Worth Trying

Hacker News •
×

Janet, a lightweight Lisp dialect, has attracted hobbyists looking for a fast‑learning language. Its core comprises only eight primitives—do, def, var, set, if, while, break, fn—yet macros expand functionality into familiar control structures. The entire standard library fits on a single page, letting newcomers achieve useful scripts after an afternoon of study without wrestling with complex type systems or heavy.

Janet compiles to bytecode, embeds it in a generated C file, and produces a statically linked native binary. A “hello world” built with version 1.27.0 on aarch64 macOS occupies 784 KB, including runtime, garbage collector, and compiler. Its parsing expression grammar engine replaces regexes, handling multiline text, HTML, JSON, and binary data. The third‑party sh library adds a shell‑like DSL for pipelines.

Embedding Janet is straightforward: link its small C library and call native functions to manipulate values, within web pages for DSLs. Collections exist in mutable and immutable forms, giving developers control over value versus reference semantics. Macros expose compile‑time execution, allowing code to generate code and serialize program state for snapshots. Janet delivers an extensible tool for scripting and utilities.