This compound expression type aids the manipulation of expressions representing monoids. It implement a free monoid under a chosen operator and generated by expressions which are explicitly tagged with the monoid operator.
Compared to cuex/monoid.h, tagging the generators makes this variant suitable for dealing with nested elements of the same monoid, where the tag protects against the associativity. In other words, it can serve as tuples of arbitrary arity (including 0 and 1) with tuple concatenation as the monoid operator.
The main advantage over an array-like implementation is O(log n) complexity for cuex_tmonoid_rightmult (single-element append).
#define CUEX_TMONOID_END CUEX_LTREE_END |
Special value for the upper bound in slicing operations to indicate slicing to the end.
Like cuex_tmonoid_product but only checks that x and y have the same operator instead of an explicitly given one.
Like cuex_tmonoid_rightmult, but don't check the operator.
Like cuex_tmonoid_rightmult_array, but don't check the operator.
cuex_t cuex_any_tmonoid_rightmult_source | ( | cuex_t | x, | |
cu_ptr_source_t | source | |||
) |
Like cuex_tmonoid_rightmult_source, but don't check the operator.
cu_bool_t cuex_is_tmonoid_meta | ( | cuex_meta_t | meta | ) |
True iff meta is the meta of a tagged monoid element.
cu_bool_t cuex_tmonoid_contains | ( | cuex_meta_t | mult, | |
cuex_t | x | |||
) |
True iff x is an element of the tagged monoid under mult.
cuex_t cuex_tmonoid_from_array | ( | cuex_meta_t | mult, | |
cuex_t * | factor_arr, | |||
size_t | factor_count | |||
) |
Returns a tagged monoid under mult with untagged factors from the array factor_arr of factor_count elements.
cuex_t cuex_tmonoid_from_source | ( | cuex_meta_t | mult, | |
cu_ptr_source_t | src | |||
) |
Returns a tagged monoid under mult with untagged factors drawn from src in order.
cuex_t cuex_tmonoid_generator | ( | cuex_meta_t | mult, | |
cuex_t | x | |||
) |
Creates a generator for the monoid under mult.
cuex_t cuex_tmonoid_identity | ( | cuex_meta_t | mult | ) |
The identity element of the tagged monoid under mult.
True iff x is a composite (not identity or generator) element of some tagged monoid.
True iff x is the identity element of some tagged monoid.
cuex_meta_t cuex_tmonoid_opr | ( | cuex_t | x | ) |
The operator of x, which must be an element of a tagged monoid.
cuex_t cuex_tmonoid_product | ( | cuex_meta_t | mult, | |
cuex_t | x, | |||
cuex_t | y | |||
) |
Returns x * y where * = mult where x and y must be members of the tagged monoid under mult.
cuex_t cuex_tmonoid_rightmult | ( | cuex_meta_t | mult, | |
cuex_t | x, | |||
cuex_t | y | |||
) |
Returns x * y where * = mult where x must be a tagged monoid under mult and y is treated as a single untagged factor.
cuex_t cuex_tmonoid_rightmult_array | ( | cuex_meta_t | mult, | |
cuex_t | x, | |||
cuex_t * | array, | |||
size_t | count | |||
) |
The result of repeated application of cuex_tmonoid_rightmult for each element of the count elements of the array array.
cuex_t cuex_tmonoid_rightmult_source | ( | cuex_meta_t | mult, | |
cuex_t | x, | |||
cu_ptr_source_t | source | |||
) |
The result of repeated application of cuex_tmonoid_rightmult for each element of source as its second argument.
cuoo_type_t cuex_tmonoid_type | ( | ) |
The object type of the members of tagged monoids.