Examples

All examples are in the examples/ directory.

Example

Description

N-Queens

Backtracking search via multi-shot continuations

Amb / Logic puzzle

Scheme-style amb operator and constraint solving (SICP Exercise 4.42)

Probability

Exact discrete probability distributions via weighted multi-shot

Dependency injection

Swap DB/email/logging implementations

Record/Replay

Record effect results, replay without side effects

Transactions

Buffer writes, commit on success, rollback on failure

Automatic differentiation

Forward-mode (dual numbers) and reverse-mode (backpropagation)

Shallow state machine

Mutable state (get/put) and traffic light controller

shift/reset, shift0/reset0

Delimited continuations: deep = shift/reset, shallow = shift0/reset0