cuex/tmonoid.h: Monoid Operations with Tagged Generators
[cuex: Expressions]

Data Structures

struct  cuex_tmonoid
struct  cuex_tmonoid_itr

Defines

#define CUEX_TMONOID_END   CUEX_LTREE_END

Typedefs

typedef struct cuex_tmonoidcuex_tmonoid_t
typedef struct cuex_tmonoid_itr cuex_tmonoid_itr_t

Functions

cuoo_type_t cuex_tmonoid_type ()
cu_bool_t cuex_is_tmonoid_type (cuex_t t)
cu_bool_t cuex_is_tmonoid_meta (cuex_meta_t meta)
cu_bool_t cuex_any_tmonoid_contains (cuex_t x)
cuex_meta_t cuex_tmonoid_opr (cuex_t x)
cu_bool_t cuex_tmonoid_contains (cuex_meta_t mult, cuex_t x)
cu_bool_t cuex_tmonoid_is_identity (cuex_t x)
cu_bool_t cuex_tmonoid_is_generator (cuex_t x)
cu_bool_t cuex_tmonoid_is_composite (cuex_t x)
cuex_t cuex_tmonoid_identity (cuex_meta_t mult)
cuex_t cuex_tmonoid_generator (cuex_meta_t mult, cuex_t x)
cuex_t cuex_tmonoid_from_valist (cuex_meta_t mult, va_list vl)
cuex_t cuex_tmonoid_from_args (cuex_meta_t mult,...)
cuex_t cuex_tmonoid_from_source (cuex_meta_t mult, cu_ptr_source_t src)
cuex_t cuex_tmonoid_from_array (cuex_meta_t mult, cuex_t *factor_arr, size_t factor_count)
cuex_t cuex_tmonoid_product (cuex_meta_t mult, cuex_t x, cuex_t y)
cuex_t cuex_any_tmonoid_product (cuex_t x, cuex_t y)
cuex_t cuex_tmonoid_rightmult (cuex_meta_t mult, cuex_t x, cuex_t y)
cuex_t cuex_any_tmonoid_rightmult (cuex_t x, cuex_t y)
cuex_t cuex_tmonoid_rightmult_source (cuex_meta_t mult, cuex_t x, cu_ptr_source_t source)
cuex_t cuex_any_tmonoid_rightmult_source (cuex_t x, cu_ptr_source_t source)
cuex_t cuex_tmonoid_rightmult_array (cuex_meta_t mult, cuex_t x, cuex_t *array, size_t count)
cuex_t cuex_any_tmonoid_rightmult_array (cuex_t x, cuex_t *array, size_t count)
size_t cuex_tmonoid_length (cuex_meta_t mult, cuex_t x)
size_t cuex_any_tmonoid_length (cuex_t x)
cuex_t cuex_tmonoid_factor_at (cuex_meta_t mult, cuex_t x, ptrdiff_t i)
cuex_t cuex_any_tmonoid_factor_at (cuex_t x, ptrdiff_t i)
cuex_t cuex_tmonoid_factor_slice (cuex_meta_t mult, cuex_t x, ptrdiff_t i, ptrdiff_t j)
cuex_t cuex_any_tmonoid_factor_slice (cuex_t x, ptrdiff_t i, ptrdiff_t j)
cu_ptr_source_t cuex_tmonoid_factor_source (cuex_meta_t mult, cuex_t x, ptrdiff_t i, ptrdiff_t j)
cu_ptr_source_t cuex_any_tmonoid_factor_source (cuex_t x, ptrdiff_t i, ptrdiff_t j)
void cuex_tmonoid_itr_init_full (cuex_meta_t mult, cuex_tmonoid_itr_t *itr, cuex_t x)
void cuex_any_tmonoid_itr_init_full (cuex_tmonoid_itr_t *itr, cuex_t x)
void cuex_tmonoid_itr_init_slice (cuex_meta_t mult, cuex_tmonoid_itr_t *itr, cuex_t x, ptrdiff_t i, ptrdiff_t j)
void cuex_any_tmonoid_itr_init_slice (cuex_tmonoid_itr_t *itr, cuex_t x, ptrdiff_t i, ptrdiff_t j)
cuex_t cuex_tmonoid_itr_get (cuex_tmonoid_itr_t *itr)
cu_bool_t cuex_tmonoid_itr_is_end (cuex_tmonoid_itr_t *itr)

Variables

cuoo_type_t cuexP_tmonoid_type

Detailed Description

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).

See also:
cuex/monoid.h: Monoid Operations
cuex/tuple.h: Support Functions for Variable Length Tuples

Define Documentation

#define CUEX_TMONOID_END   CUEX_LTREE_END

Special value for the upper bound in slicing operations to indicate slicing to the end.


Function Documentation

cu_bool_t cuex_any_tmonoid_contains ( cuex_t  x  ) 

True iff x is an element of some tagged monoid.

cuex_t cuex_any_tmonoid_product ( cuex_t  x,
cuex_t  y 
)

Like cuex_tmonoid_product but only checks that x and y have the same operator instead of an explicitly given one.

cuex_t cuex_any_tmonoid_rightmult ( cuex_t  x,
cuex_t  y 
)

Like cuex_tmonoid_rightmult, but don't check the operator.

cuex_t cuex_any_tmonoid_rightmult_array ( cuex_t  x,
cuex_t array,
size_t  count 
)

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_is_tmonoid_type ( cuex_t  t  ) 

True iff t is the type 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.

cu_bool_t cuex_tmonoid_is_composite ( cuex_t  x  ) 

True iff x is a composite (not identity or generator) element of some tagged monoid.

cu_bool_t cuex_tmonoid_is_generator ( cuex_t  x  ) 

True iff x is a generator for some tagged monoid.

cu_bool_t cuex_tmonoid_is_identity ( cuex_t  x  ) 

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.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.