recursion_schemes v0.1.0 RecStruct protocol
Functions for working with recursive data structures.
Link to this section Summary
Functions
base?/1
is a predicate to test whether a recursively defined data structure
is at its base case
empty/1
is a function for obtaining the base value of a recursively
defined data structure
unwrap/1
describes how to access the current and remaining pieces of
data in a recursively defined structure
wrap/2
is a function for adding a new element to a recursive data structure.
To have the dispatch on the protocol happen correctly, the data structure
must be the first argument
Link to this section Types
Link to this section Functions
base?/1
is a predicate to test whether a recursively defined data structure
is at its base case.
empty/1
is a function for obtaining the base value of a recursively
defined data structure.
unwrap/1
describes how to access the current and remaining pieces of
data in a recursively defined structure.
It should return a tuple of {current value, remaining values}
wrap/2
is a function for adding a new element to a recursive data structure.
To have the dispatch on the protocol happen correctly, the data structure
must be the first argument.