Back
A Friendly Introduction to Racket, the Modern Heir of the Lisp Family
SiTech AI Team3 წთ. საკითხავი

A Friendly Introduction to Racket, the Modern Heir of the Lisp Family

A new tutorial on the blog geometridae.bearblog.dev walks readers through Racket, the language that continues Lisp's 1958 lineage — and promises that by the end they will have written their own syntax.

A friendly introduction to Racket, a modern descendant of one of programming's oldest and most unusual language families, has been published on the blog geometridae.bearblog.dev. The tutorial promises that readers will write their own syntax by the end.

From Lisp to Scheme to Racket

Lisp was created in 1958 by John McCarthy at MIT — the second-oldest high-level language still in use, beaten only by Fortran (1957). Python arrived in 1991 and JavaScript in 1995.

Several ideas we now call modern were born in Lisp: garbage collection, first-class functions, the read-eval-print loop, conditionals that return a value, and homoiconicity — the property that code is itself a data structure of the language. In the 1970s and 1980s Lisp even ran directly on hardware, in the Lisp Machines built by Symbolics and LMI. After the “AI winter” funding dried up and the language lost its star status.

In 1975 Gerald Sussman and Guy Steele created Scheme, a minimalist, almost mathematical Lisp that became academia's favourite teaching language and the language of the classic textbook SICP. In 1995 Matthias Felleisen's group created PLT Scheme, renamed Racket in 2010. Today Racket is more than a Scheme: it is a language for building languages, and its unofficial motto is language-oriented programming.

Who uses Lisp today

Clojure runs in production at banks, airlines and startups — Nubank, the largest digital bank in Latin America, is built on it. Common Lisp, with the SBCL compiler, is still alive in expert systems, flight planning (ITA Software, acquired by Google and a basis for Google Flights) and scientific computing.

Millions of people run Lisp every day without noticing, because their editor is a Lisp interpreter: Emacs Lisp. GNU Guix is an entire Linux distribution configured 100% in Scheme. Racket has its own annual conference, RacketCon, and is used for language research, formal verification (Rosette), typography and publishing (Pollen).

What the code looks like

Installation takes five minutes: an installer from racket-lang.org and the bundled DrRacket environment, with a REPL below. The first line of a file is #lang racket, which selects the language — Racket, after all, is a language factory.

The rule of Lisp fits in one line: everything is (operator argument1 argument2 …), with no exceptions. (+ 1 2) returns 3, (* 3 (+ 2 2)) returns 12, and (string-append "hello " "world") returns "hello world". There is no operator precedence and no special syntax; define names a constant or a function, and lambda creates an anonymous one.

Lisp stands for LISt Processing: (first '(1 2 3)) returns 1, (rest '(1 2 3)) returns (2 3), and (cons 0 '(1 2 3)) returns (0 1 2 3). With map, filter and foldl most list problems can be solved without writing a single for loop. Recursion is the natural style — a factorial is written so the base case and the step towards it are visible.

The finale is macros: the quote mark turns code into data, and eval turns data back into running code. Using define-syntax-rule, the tutorial even adds a while loop that the language does not ship with. Alan Kay called Lisp “the Maxwell's equations of software” — a tiny core from which everything else can be derived.

SSiTech

SiTech — AI-powered web development

We build fast, modern websites and bring AI into real business workflows. Have a project or a question? We'd love to help.