Skip to content

ambutils

Bill Hails edited this page May 9, 2026 · 5 revisions

The namespace fn/ambutils.fn contains a few utilities for working with then and back.

Fn Description
require(condition) Backtracks if condition is not true.
one_of(list) Successively generates each element of the list, backtracking further when the list is exhausted.
some_of (list) Successively generates each non-empty subset of the list, backtracking further when the list is exhausted.
integers_from(n) Generates all integers, starting from n. Never backtracks.
integers_between(lower, upper) Generates all integers between lower and upper inclusive, backtracks when exhausted.

ambutils.fn also exports a number of operators and macros, for example ... is postfix integers_from and search is macro syntax for a simple amb query DSL.

Next: IO Utils

Clone this wiki locally