Convert README to org, point clone at git.venomade.com, add AI-provenance warning

This commit is contained in:
venomade committed 2026-11-22 12:41:09 +00:00
1 parent fd5e11cdeb
commit e68a831117
2 files changed
+207 -204

No files matched your search

+207
View File
@@ -0,0 +1,207 @@
#+title: Lisplings
#+options: toc:nil
#+begin_example
/
/
/
/\
/ \
/ \
#+end_example
Small exercises to get you used to reading and writing
[[https://common-lisp.net][Common Lisp]] code - recommended in parallel with a book like
[[http://www.gigamonkeys.com/book/][Practical Common Lisp]].
Lisplings is what [[https://github.com/rust-lang/rustlings][Rustlings]] is to Rust: a watcher runs the exercise you are
on, you fix it in your editor, and saving the file runs it again. Everything,
including the exercises, the checks, and lisplings itself, is plain Common Lisp.
* Warning: AI-generated ("vibe coded") software
This project was created entirely by an AI agent: =mistral-large-4= as the
primary model, delegating all review, authoring, and implementation work to
=opencode/glm-5.3= subagents. It is vibe coded software: every exercise was
verified mechanically (each broken exercise fails, each solution passes;
=dev/verify.sh= runs all 105), but no human has read it end to end. Read it
with that in mind, and treat anything surprising as a bug worth reporting.
* Getting started
You need [[http://www.sbcl.org][SBCL]]. Any recent version works; no libraries beyond it.
** Without nix
#+begin_src sh
git clone https://git.venomade.com/venomade/lisplings.git
cd lisplings
./lisplings
#+end_src
(SSH works too: =git@git.venomade.com:venomade/lisplings.git=)
** With nix
The flake provides a pinned SBCL, a dev shell, and the lisplings runner. The
nix store is read-only, so create your own writable course directory first -
the runner then operates on the directory it is started from:
#+begin_src sh
nix run . -- init my-lisplings # copy the course out of the store
cd my-lisplings
nix run /path/to/lisplings # watch mode, on this directory
#+end_src
=nix develop= gives a shell with SBCL for working on lisplings itself.
* The workflow
1. Run =./lisplings= from the repository root (or your project copy).
2. Lisplings keeps one status screen on your terminal: the current exercise
file, the output of its checks, the hints you revealed, a progress bar, and
the keys that work right now. Crossing into a new chapter prints that
chapter's README above the exercise; =run <name>= prints the target
chapter's README too.
3. The watcher opens each new exercise in =$EDITOR= (or =$VISUAL=). Edit and
save; the exercise runs again and the screen redraws; when every check
passes it shows =Exercise done ✓= and the matching solution to compare
against. Pass =--no-editor=, or set =LISPLINGS_NO_EDITOR=, to open files by
hand instead.
4. Press =n= for the next exercise.
Keys in watch mode (each key is a line: type it, then press ENTER):
| key | action |
|-----+---------------------------------------------|
| n | move to the next pending exercise |
| h | reveal the next hint paragraph (stays pinned) |
| r | rerun the current exercise |
| l | list exercises, then jump by name or number |
| x | reset the current exercise (asks y/n) |
| q | save progress and quit |
Keys typed while a check is running are ignored; press the key again once it
finishes.
Really stuck? =solutions/= mirrors =exercises/= with every exercise solved.
* Commands
#+begin_src sh
./lisplings watch the current exercise (the default)
./lisplings --no-editor watch without opening $EDITOR
./lisplings run [name] run one exercise; also selects it as current
./lisplings hint [name] print every hint paragraph, numbered
./lisplings list [pending|done|all]
./lisplings reset <name> restore an exercise to its pristine state
./lisplings check-all run every exercise and resync progress
./lisplings init [dir] create a lisplings project in dir
./lisplings help show all commands
#+end_src
Progress lives in =.lisplings-state.sexp= - a plain s-expression you can read
and edit. =reset= restores from a pristine snapshot under =.lisplings-orig/=;
snapshots are taken lazily per exercise, from git when possible, so an
exercise added after the first run still resets to its original broken file.
* How an exercise works
Every exercise is a plain file of Common Lisp with the broken part marked
TODO, and a checks section at the bottom:
#+begin_src lisp
;; TODO: Return twice the argument.
(defun twice (x)
x)
;;; Checks. Read them - they tell you what to aim for - but leave
;;; them unchanged.
(check-equal 10 (twice 5))
#+end_src
The checks are ordinary macros, defined in =src/harness.lisp=: =check= asserts
a non-NIL value, =check-equal= compares with EQUAL, and =check-error= waits
for a condition. Nothing is hidden - the tests live in the same file you edit,
which is the Lispy way.
* The course
105 exercises in 23 chapters, from first forms to restarts, macros, and a tiny
Lisp interpreter:
#+begin_example
00_intro 01_sexps 02_functions 03_variables
04_conditionals 05_predicates 06_lists 07_recursion
08_functional 09_strings 10_loops 11_numbers
12_structs 13_hash_tables 14_packages 15_clos
16_conditions 17_macros 18_dynamic 19_sequences
20_vectors 21_files quizzes
#+end_example
Each chapter directory has a README with a two-line summary of the ideas, and
every exercise has a hint (=h=) and a solved twin under =solutions/=.
* Chapter to book mapping
Two references will carry you from here. [[http://www.gigamonkeys.com/book/][Practical Common Lisp]] ("PCL") is the
book this course runs parallel to; the [[https://www.lispworks.com/documentation/HyperSpec/Front/][Common Lisp HyperSpec]] ("CLHS") is
the language's complete reference. Where each chapter points:
| Lisplings chapter | PCL | CLHS |
|-------------------+-----+------|
| 00_intro | ch. 1-2 (Introduction; A Tour of the REPL) | n/a |
| 01_sexps | ch. 4 (Syntax and Semantics) | §2-3 (character syntax, evaluation) |
| 02_functions | ch. 5 (Functions) | §3 (lambda, function) |
| 03_variables | ch. 6 (Variables) | §3 (let, let*, defvar), §5 (setf) |
| 04_conditionals | ch. 7 (Macros: Standard Control Constructs) | §5 (data and control flow) |
| 05_predicates | n/a (equality bits live in ch. 4 and ch. 10) | §4 (types), §5 (eq, eql, equal, equalp) |
| 06_lists | ch. 11-12 (Collections; List Processing) | §14 (conses) |
| 07_recursion | ch. 12-13 (lists, trees) | §14 (conses) |
| 08_functional | ch. 5, ch. 11-12 (function values; mapcar and friends) | §17 (mapcar), §5 (funcall, apply) |
| 09_strings | ch. 10 (Numbers, Characters, and Strings); ch. 18 (A Few FORMAT Recipes) | §16 (strings), §22 (format) |
| 10_loops | ch. 7 (dolist, dotimes); LOOP for Black Belts | §6 (iteration) |
| 11_numbers | ch. 10 (Numbers, Characters, and Strings) | §12 (numbers) |
| 12_structs | n/a (PCL goes straight to objects, ch. 16-17) | §8 (structures) |
| 13_hash_tables | ch. 11 (Collections) | §18 (hash tables) |
| 14_packages | n/a (no dedicated PCL chapter) | §11 (packages) |
| 15_clos | ch. 16-17 (Object Reorientation) | §7 (objects) |
| 16_conditions | ch. 19 (Beyond Exception Handling: Conditions and Restarts) | §9 (conditions) |
| 17_macros | ch. 7-8 (Standard Control Constructs; Defining Your Own) | §3 (defmacro, macroexpand) |
| 18_dynamic | ch. 6 (closures, special variables) | §3 (dynamic binding), §5 (catch, throw) |
| 19_sequences | ch. 11 (Collections: sequence functions) | §17 (sequences) |
| 20_vectors | ch. 11 (vectors; strings are vectors, ch. 10) | §15 (arrays), §16 (strings) |
| 21_files | ch. 14-15 (Files and File I/O; A Portable Pathnames Library) | §19-21 (filenames, files, streams) |
| quizzes | quiz3: ch. 11, ch. 13; quiz1: ch. 3, ch. 13; quiz2: ch. 4 | n/a |
* The finish line
When the last check of the last exercise passes, lisplings prints its closing
message: the lambda from the top of this file, now yours, plus where to go
next - which Practical Common Lisp chapters follow the course, how Quicklisp
and ASDF fit in, and a reminder that =(describe)= and =(apropos)= answer
questions right in the REPL. The text lives in =info.sexp= under =:final=; make
it yours. Want to keep going? Add the exercise you wish had been there - the
recipe is in "Hacking on lisplings" below.
* Hacking on lisplings
Lisplings itself is a few hundred lines of SBCL with no dependencies: the
watcher (=src/main.lisp=, =src/core.lisp=), the check harness every exercise
runs under (=src/harness.lisp=), and the subprocess that runs one exercise
(=src/exercise-runner.lisp=).
#+begin_src sh
dev/verify.sh # every exercise fails when broken, passes when solved
#+end_src
The watcher shows color only on a terminal, and turns it off for =NO_COLOR= or
=TERM=dumb=. The exercise subprocess writes to a pipe, so it cannot detect the
terminal itself: the watcher passes the decision on as =LISPLINGS_COLOR=always=
or ==never=. To debug piped output, force it with
=LISPLINGS_COLOR=always ./lisplings ... | cat -v=.
To add an exercise: write the broken =exercises/<chapter>/<name>.lisp= and the
solved =solutions/<chapter>/<name>.lisp=, add a =(:name ... :dir ... :hint
...)= entry to =info.sexp=, and run =dev/verify.sh=.