Crate adapton [] [src]

Adapton for Rust

This Rust implementation embodies the latest implementation Adapton, which offers a foundational, language-based semantics for general-purpose incremental computation.

Programming interface in Rust: For an overview of its Rust programming interface, see the documentation for the adapton::macros module, which wraps the adapton::engine module with some convenient macros.

See also:

Background:

Adapton proposes the demanded computation graph (or DCG), and a demand-driven change propagation algorithm. Further, it proposes first-class names for identifying cached data structures and computations.

The following academic papers detail these technical proposals:

Why Rust?

Adapton's first implementations used Python and OCaml; The latest implementation in Rust offers the best performance thus far, since (1) Rust is fast, and (2) traversal-based garbage collection presents performance challenges for incremental computation. By liberating Adapton from traversal-based collection, our empirical results are both predictable and scalable.

Modules

catalog

Experimental collections, including those for sequences and sets. (See also: The IODyn crate)

engine

Adapton's core calculus, implemented as a runtime library. We implement two versions of this interface, which we refer to as engines: The naive engine and the DCG engine, implemented based on the algorithms from the Adapton papers.

macros

Macros to make using the engine module's interface more ergonomic.

parse_val

Parses the output of Rust Debug strings into reflected values of type Val. (See engine::reflect module).

reflect

Reflects the DCG engine, including both the effects of the programs running in it, and the internal effects of the engine cleaning and dirtying the DCG. For the latter effects, see the trace module.

Macros

cell

Convenience wrapper for engine::cell

cell_call

Convenience wrapper: Call a function and place the result into an engine::cell.

eager

Similar to memo!, except return both the thunk and its observed (forced) value.

get

Convenience wrapper for engine::force

let_cell

Let-bind a nominal ref cell via cell, using the let-bound variable identifier as its name. Permits sequences of bindings.

let_memo

Let-bind a nominal thunk, force it, and let-bind its result. Permits sequences of bindings.

let_thunk

Let-bind a nominal thunk via thunk!, without forcing it. Permits sequences of bindings.

memo

Convenience wrapper for engine::thunk and engine::force: creates a thunk and immediately forces it.

prog_pt

Generate a "program point", used as a unique ID for memoized functions.

thunk

Convenience wrapper for engine::thunk