#include <muse.h>
Data Fields | |
| muse_cell(* | size )(void *self) |
| Should return the number of elements in the data structure. | |
| muse_cell(* | map )(void *self, muse_cell fn) |
| Iterates the given function over all the "elements" of this object and constructs a new object of the same type with the results. | |
| muse_cell(* | join )(void *self, muse_cell obj, muse_cell reduction_fn) |
| Joins two objects (must be of the same type) using the given reduction_fn to resolve conflicts. | |
| muse_cell(* | collect )(void *self, muse_cell predicate, muse_cell mapper, muse_cell reduction_fn) |
Iterates over the elements of this object, applying the predicate. | |
| muse_cell(* | reduce )(void *self, muse_cell reduction_fn, muse_cell initial) |
| Applies the given reduction function, which is expected to be commutative and associative for simplicity, and folds the results into successive reduction calls, returning the final outcome as the result. | |
| muse_cell(* muse_monad_view_t::size)(void *self) |
Should return the number of elements in the data structure.
| muse_cell(* muse_monad_view_t::map)(void *self, muse_cell fn) |
Iterates the given function over all the "elements" of this object and constructs a new object of the same type with the results.
| muse_cell(* muse_monad_view_t::join)(void *self, muse_cell obj, muse_cell reduction_fn) |
Joins two objects (must be of the same type) using the given reduction_fn to resolve conflicts.
Two vectors are joined by concatenation. Two lists are are joined by concatenation. Two hashtables are joined by merging their key-value pairs into a single table (you can do set union using this).
| muse_cell(* muse_monad_view_t::collect)(void *self, muse_cell predicate, muse_cell mapper, muse_cell reduction_fn) |
Iterates over the elements of this object, applying the predicate.
All the elements satisfying the predicate are collected into a new object of the same type. If the mapper parameter is not MUSE_NIL, it is expected to be a function that will be used to transform the element before collecting it into the new object. If the mapper is MUSE_NIL, it is equivalent to an identity function.
| muse_cell(* muse_monad_view_t::reduce)(void *self, muse_cell reduction_fn, muse_cell initial) |
Applies the given reduction function, which is expected to be commutative and associative for simplicity, and folds the results into successive reduction calls, returning the final outcome as the result.
1.4.7