Tiny Programs and Languages

Tiny programs and languages prove small code can be powerful and approachable.

16 cards · 1m 40s · tap to begin

From · · 1m 40s

Tiny Programs and Languages

Tiny programs and languages prove small code can be powerful and approachable.

In brief

Tiny programs and languages prove small code can be powerful and approachable. Tiny programs and languages demonstrate that minimal code can be both functional and accessible. Originally reported by Ratfactor.

Tiny programs

Tiny programs are approachable and interesting when they do something useful in few lines.

25-line JavaScript library

Luke Jackson's ijk library has just 25 lines of code for DOM diffing.

46-byte Forth

Philippe Brochard created a 46-byte Forth program that fits on a business card.

“50b8 8e00 31d8 e8ff 0017 003c 0575 00ea 5000 3c00 7401 eb02 e8ee 0005 0588 eb47 b8e6 0200 d231 14cd e480 7580 c3f4”

Arthur Whitney's interpreter

Arthur Whitney wrote an array-based language interpreter in 122 lines of C.

kOS operating system

kOS is a 90 Kb bootable image with a GUI and window manager in 60 lines of C.

Lisp interpreter

William Byrd's Lisp interpreter fits on a single slide with 436 bytes of code.

“(define eval-expr (lambda (expr env) (pmatch expr [`,x (guard (symbol? x)) (env x)] [`(lambda (,x),body) (lambda (arg) (eval-expr body (lambda (y) (if (eq? x y) arg (env y)))))] [`(,rator,rand) ((eval-expr rator env) (eval-expr rand env))])))”

Ray tracer

A ray tracer fits on a business card with minimal code complexity.

Kolmogorov complexity

Kolmogorov complexity measures the minimum code length to produce a given output.

Small languages

Small languages like Forth, Lisp, and Tcl offer minimal syntax with high expressiveness.

Forth

Forth uses only space characters as syntax and is highly flexible.

Lisp

Lisp has small core syntax but enormous expressive power and flexibility.

Tcl

Tcl treats everything as a string and allows custom language construction.

Lua

Lua's core language fits on 27 pages of documentation.

JavaScript

JavaScript's core language is small with functions, arrays, and objects.

David Ungar

David Ungar argues simplicity trumps expressiveness in programming languages.

“It’s far better to make a system a little too simple so a person has to write extra stuff, even write it twice with a comment that says, 'Look over here,' than to have a system that acts in strange ways and nobody can understand why.”

Small scale benefits

Small things are approachable, manageable, and spark joy through simplicity.

The big picture

Tiny programs and languages demonstrate that minimal code can be both functional and accessible.

Read the original on Ratfactor

React

Sign in to react and comment.

Comments (0)

Life is short. Keep it sweet. Respect others' opinions and be kind!

    Recommended next

    More decks on forth and related topics.