RC RANDOM CHAOS

Racket: The Lisp That Lets You Build Your Own Programming Language

· via Hacker News

Original source

A Friendly Introduction to Racket

Hacker News →

This tutorial introduces Racket, a modern descendant of Lisp, the 1958 language that pioneered ideas now considered standard: garbage collection, first-class functions, the REPL, and conditionals that return values. Its defining trait is homoiconicity — code and data share the same list structure — which enables true macros: functions that transform code before it runs. Racket descends from Scheme (the minimalist teaching Lisp behind SICP) via PLT Scheme, and its distinguishing pitch is language-oriented programming: if a problem needs a domain-specific language, Racket is built to let you create one quickly.

The piece walks through fundamentals with concrete examples — everything is an (operator arguments…) expression, definitions and lambdas, list operations, higher-order functions like map/filter/foldl, and recursion illustrated with a Sierpinski triangle drawn using Racket’s bundled graphics library. It culminates in the quote-and-eval trick and a homemade while loop built with define-syntax-rule, showing how developers can extend the language’s own syntax.

Far from a dead academic curiosity, Lisp remains in production: Clojure powers Nubank and other financial systems, Common Lisp underpinned ITA Software (Google Flights), Emacs runs on Elisp, and Guix configures an entire Linux distro in Scheme. Racket itself supports formal verification (Rosette), publishing (Pollen), and education worldwide. For technical readers, the takeaway is that Lisp’s macro system and metaprogramming model — languages as first-class, malleable artifacts — still offer capabilities most mainstream languages lack.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.