Show HN: A Lisp where each function call runs a Docker container
Source: Hacker News
Docker Lisp
A Docker image is a piece of executable code that produces some output given some input.
Requirements
- Docker
Setup
-
Build the base images and built‑ins:
./scripts/build-base ./scripts/build-builtins -
Run the tests (be patient):
./scripts/run-tests
Usage
Evaluate an expression
./scripts/run eval "(cons 1 2)"
Trace evaluation
./scripts/run --trace eval "(car (cdr (cons 1 (cons 2 (list)))))"
You can also monitor the evaluation with docker stats and docker events.
Write and run a program
Create a Dockerfile that starts from docker-lisp/eval and supplies the program as the command, e.g.:
FROM docker-lisp/eval
CMD ["(define fact (lambda (n) (if (number-equals n 0) 1 (multiply n (fact (subtract n 1))))))", "(fact 3)"]
Build the program:
./scripts/build [name]
If name is omitted, the filename is used.
Run the built program:
./scripts/run
Scripts
| Script | Purpose |
|---|---|
build [name] | Build a Dockerfile into docker-lisp/. Defaults to the file’s basename. |
build-base | Build base images (docker-lisp/base-racket, docker-lisp/base-call). |
build-builtins | Build all builtin images. |
run [--trace] [--no-cleanup] [args] | Run a docker-lisp/ container. |
run-tests [--no-trace] [--rebuild-base] [prefix filter] | Run the test suite (traces enabled by default). |
clean | Kill all docker-lisp/* containers and remove all built docker-lisp/* images. |
