|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
CRTP Mixin providing functional programming operations. More...
#include <ah-dry-mixin.H>
Public Member Functions | |
| template<class Operation > | |
| auto | for_each (Operation &operation) const -> decltype(self()) |
| Apply an operation to each element (read-only). | |
| template<class Operation > | |
| auto | for_each (Operation &operation) -> decltype(self()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<class Operation > | |
| auto | for_each (Operation &&operation=Operation()) const -> decltype(self()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<class Operation > | |
| auto | for_each (Operation &&operation=Operation()) -> decltype(self()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<class Operation > | |
| auto | mutable_for_each (Operation &operation) -> decltype(self()) |
| Apply an operation to each element (mutable). | |
| template<class Operation > | |
| auto | mutable_for_each (Operation &&operation=Operation()) -> decltype(self()) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<class Operation > | |
| bool | all (Operation &operation) const |
| Test if all elements satisfy a predicate. | |
| template<class Operation > | |
| bool | all (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<class Operation > | |
| bool | forall (Operation &operation) const |
| Alias for all(). | |
| template<class Operation > | |
| bool | forall (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<class Operation > | |
| bool | exists (Operation &operation) const |
| Test if any element satisfies a predicate. | |
| template<class Operation > | |
| bool | exists (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<typename __Type = Type, template< typename > class Container = Aleph::DynList, class Operation = Dft_Map_Op<Type, __Type>> | |
| Container< __Type > | maps (Operation &operation) const |
| Transform elements using a mapping function. | |
| template<typename __Type = Type, template< typename > class Container = Aleph::DynList, class Operation = Dft_Map_Op<Type, __Type>> | |
| Container< __Type > | maps (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<typename __Type = Type> | |
| __Type | foldl (const __Type &init, std::function< __Type(const __Type &, const Type &)> operation) const |
| Left fold (reduce) with initial value. | |
| template<typename __Type = Type> | |
| __Type | fold_left (std::function< __Type(const __Type &, const Type &)> operation, const __Type &init) const |
| Left fold with operation first (alternative signature). | |
| template<class Operation > | |
| Type | fold (const Type &init, Operation &operation) const |
| Simple fold with same type for accumulator and elements. | |
| template<class Operation > | |
| Type | fold (const Type &init, Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<class Operation > | |
| DynList< Type > | filter (Operation &operation) const |
| Filter elements by a predicate. | |
| template<class Operation > | |
| DynList< Type > | filter (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<class Operation > | |
| DynList< std::tuple< Type, size_t > > | pfilter (Operation &operation) const |
| Filter with position information. | |
| template<class Operation > | |
| DynList< std::tuple< Type, size_t > > | pfilter (Operation &&operation=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<class Operation > | |
| std::pair< DynList< Type >, DynList< Type > > | partition (Operation &op) const |
| Partition elements by a predicate. | |
| template<class Operation > | |
| std::pair< DynList< Type >, DynList< Type > > | partition (Operation &&op=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<class Operation > | |
| std::tuple< DynList< Type >, DynList< Type > > | tpartition (Operation &op) const |
| Partition returning tuple instead of pair. | |
| template<class Operation > | |
| std::tuple< DynList< Type >, DynList< Type > > | tpartition (Operation &&op=Operation()) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| size_t | length () const noexcept |
| Count the number of elements. | |
| template<template< typename > class Container = Aleph::DynList> | |
| Container< Type > | rev () const |
| Create a reversed copy. | |
| template<template< typename > class Container = Aleph::DynList> | |
| Container< Type > | take (const size_t n) const |
| Take the first n elements. | |
| template<template< typename > class Container = Aleph::DynList> | |
| Container< Type > | drop (const size_t n) const |
| Skip the first n elements. | |
| Type | sum (const Type &init=Type{}) const |
| Compute the sum of all elements. | |
| Type | product (const Type &init) const |
| Compute the product of all elements. | |
| const Type * | min () const |
| Find the minimum element. | |
| const Type * | max () const |
| Find the maximum element. | |
| template<class Compare > | |
| const Type * | min_by (Compare cmp) const |
| Find the minimum element using a custom comparator. | |
| template<class Compare > | |
| const Type * | max_by (Compare cmp) const |
| Find the maximum element using a custom comparator. | |
| bool | has_value (const Type &val) const |
| Check if container has a value. | |
| template<class Predicate > | |
| bool | none (Predicate &pred) const |
| Check if no element satisfies a predicate. | |
| template<class Predicate > | |
| bool | none (Predicate &&pred) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<class Predicate > | |
| size_t | count_if (Predicate pred) const |
| Count elements satisfying a predicate. | |
| const Type * | first () const |
| Get the first element. | |
| Type | first_or (const Type &default_val) const |
| Get the first element or a default value. | |
| const Type * | last () const |
| Get the last element. | |
| Type | last_or (const Type &default_val) const |
| Get the last element or a default value. | |
| template<template< typename > class Container = Aleph::DynList> | |
| Container< std::pair< size_t, Type > > | enumerate () const |
| Enumerate elements with their indices. | |
| template<class Predicate > | |
| size_t | find_index (Predicate pred) const |
| Find the index of the first element satisfying a predicate. | |
| size_t | index_of (const Type &val) const |
| Find the index of a specific value. | |
| template<template< typename > class Container = Aleph::DynList> requires requires(Type a, Type b) { { a == b } -> std::convertible_to<bool>; } | |
| Container< Type > | unique () const |
| Remove consecutive duplicate elements. | |
| template<template< typename > class Container = Aleph::DynList, class EqPred > | |
| Container< Type > | unique_by (EqPred eq) const |
| Remove consecutive duplicates using a custom equality predicate. | |
| template<template< typename > class Container = Aleph::DynList> | |
| Container< Type > | intersperse (const Type &sep) const |
| Intersperse a separator between elements. | |
| template<template< typename > class Container = Aleph::DynList> | |
| Container< Container< Type > > | chunk (size_t n) const |
| Split into chunks of fixed size. | |
| template<template< typename > class Container = Aleph::DynList> | |
| Container< Container< Type > > | sliding (size_t size, size_t step=1) const |
| Create sliding windows of fixed size. | |
| std::vector< Type > | to_vector () const |
| Convert to std::vector. | |
| template<typename DynListType = DynList<Type>> | |
| DynListType | to_dynlist () const |
| Convert container to DynList. | |
| template<typename StringType = std::string> requires requires(Type a) { std::to_string(a); } | |
| StringType | join (const StringType &sep=StringType{", "}) const |
| Join elements into a string with separator. | |
| std::string | join_str (const std::string &sep=", ") const |
| Join string elements with separator. | |
| template<class Other , template< typename > class Container = Aleph::DynList> | |
| Container< std::pair< Type, typename Other::Item_Type > > | zip_with (const Other &other) const |
| Zip with another container. | |
Protected Member Functions | |
| const Derived & | self () const noexcept |
| Derived & | self () noexcept |
CRTP Mixin providing functional programming operations.
This mixin adds functional programming methods to containers:
| Derived | The derived container class (CRTP pattern). |
| Type | The element type stored in the container. |
traverse() method (typically via TraverseMixin)for_each() method (provided by this mixin, but needs traverse)Definition at line 457 of file ah-dry-mixin.H.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 592 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Test if all elements satisfy a predicate.
Returns true if the predicate returns true for every element. Returns true for empty containers (vacuous truth).
| Operation | Callable with signature bool(const Type&). |
| operation | Predicate to test. |
Definition at line 585 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps(), and Aleph::FunctionalMixin< Derived, Type >::self().
Referenced by Aleph::FunctionalMixin< Derived, Type >::sliding(), TEST(), TEST(), and TEST().
|
inline |
Split into chunks of fixed size.
| n | Chunk size. |
Definition at line 1589 of file ah-dry-mixin.H.
References Aleph::count(), Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Count elements satisfying a predicate.
| Predicate | Predicate type. |
| pred | Predicate function. |
Definition at line 1276 of file ah-dry-mixin.H.
References Aleph::count(), Aleph::FunctionalMixin< Derived, Type >::for_each(), Aleph::FunctionalMixin< Derived, Type >::maps(), and pred.
Skip the first n elements.
| n | Number of elements to skip. |
Definition at line 1011 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps(), and Aleph::FunctionalMixin< Derived, Type >::self().
Referenced by TEST().
|
inline |
Enumerate elements with their indices.
Definition at line 1399 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 642 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Test if any element satisfies a predicate.
Returns true if the predicate returns true for at least one element. Returns false for empty containers.
| Operation | Callable with signature bool(const Type&). |
| operation | Predicate to test. |
Definition at line 632 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps(), and Aleph::FunctionalMixin< Derived, Type >::self().
Referenced by Aleph::FunctionalMixin< Derived, Type >::none(), Aleph::FunctionalMixin< Derived, Type >::none(), TEST(), and TEST().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 811 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Filter elements by a predicate.
Creates a new list containing only elements for which the predicate returns true.
| Operation | Callable with signature bool(const Type&). |
| operation | Predicate function. |
Definition at line 798 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Find the index of the first element satisfying a predicate.
| Predicate | Predicate type. |
| pred | Predicate function. |
Definition at line 1426 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps(), pred, and Aleph::FunctionalMixin< Derived, Type >::self().
|
inline |
Get the first element.
Definition at line 1304 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps(), and Aleph::FunctionalMixin< Derived, Type >::self().
Referenced by Aleph::FunctionalMixin< Derived, Type >::first_or(), Aleph::FunctionalMixin< Derived, Type >::intersperse(), Aleph::FunctionalMixin< Derived, Type >::join_str(), TEST(), TEST(), TEST(), TEST(), and TEST().
Get the first element or a default value.
| default_val | Value to return if container is empty. |
Definition at line 1329 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::first(), and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 773 of file ah-dry-mixin.H.
References Aleph::init, and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Simple fold with same type for accumulator and elements.
Simplified version of foldl() where accumulator has same type as elements.
| Operation | Binary operation type. |
| init | Initial value. |
| operation | Binary operation. |
Definition at line 761 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::for_each(), Aleph::init, and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Left fold with operation first (alternative signature).
Definition at line 745 of file ah-dry-mixin.H.
References Aleph::init, and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Left fold (reduce) with initial value.
Combines all elements using a binary operation, starting from an initial value. Computes: op(...op(op(init, x1), x2)..., xn).
| __Type | Accumulator type (default: same as element Type). |
| init | Initial value for the accumulator. |
| operation | Binary operation: (accumulator, element) -> new_accumulator. |
Definition at line 730 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::for_each(), Aleph::init, and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 524 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 517 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 505 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps(), and Aleph::FunctionalMixin< Derived, Type >::self().
|
inline |
Apply an operation to each element (read-only).
Iterates through all elements, calling the operation on each. Unlike traverse(), always visits all elements (cannot stop early).
| Operation | Callable with signature void(const Type&). |
| operation | The operation to apply. |
Definition at line 493 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps(), and Aleph::FunctionalMixin< Derived, Type >::self().
Referenced by Aleph::FunctionalMixin< Derived, Type >::chunk(), Aleph::FunctionalMixin< Derived, Type >::count_if(), Aleph::FunctionalMixin< Derived, Type >::enumerate(), Aleph::FunctionalMixin< Derived, Type >::filter(), Aleph::FunctionalMixin< Derived, Type >::fold(), Aleph::FunctionalMixin< Derived, Type >::foldl(), Aleph::FunctionalMixin< Derived, Type >::intersperse(), Aleph::FunctionalMixin< Derived, Type >::join_str(), Aleph::FunctionalMixin< Derived, Type >::last(), Aleph::FunctionalMixin< Derived, Type >::length(), Aleph::FunctionalMixin< Derived, Type >::maps(), Aleph::FunctionalMixin< Derived, Type >::max_by(), Aleph::FunctionalMixin< Derived, Type >::min_by(), Aleph::outer_product(), Aleph::FunctionalMixin< Derived, Type >::partition(), Aleph::FunctionalMixin< Derived, Type >::pfilter(), Aleph::FunctionalMixin< Derived, Type >::rev(), Aleph::FunctionalMixin< Derived, Type >::sliding(), TEST(), TEST(), Aleph::FunctionalMixin< Derived, Type >::to_dynlist(), Aleph::FunctionalMixin< Derived, Type >::to_vector(), Aleph::FunctionalMixin< Derived, Type >::tpartition(), and Aleph::FunctionalMixin< Derived, Type >::unique_by().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 608 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Alias for all().
Definition at line 601 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
Check if container has a value.
| val | Value to search for. |
has_value() to avoid conflicts with contains() in tree/hash containers which have O(log n) or O(1) implementations.Definition at line 1224 of file ah-dry-mixin.H.
Find the index of a specific value.
| val | Value to search for. |
Definition at line 1461 of file ah-dry-mixin.H.
|
inline |
Intersperse a separator between elements.
| sep | Separator to insert between each pair of elements. |
Definition at line 1555 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::first(), Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Join elements into a string with separator.
| sep | Separator string (default: ", "). |
Definition at line 1731 of file ah-dry-mixin.H.
|
inline |
Join string elements with separator.
| sep | Separator string (default: ", "). |
Definition at line 1760 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::first(), Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Get the last element.
Definition at line 1348 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
Referenced by Aleph::Cnode::extract_word_from_stack(), Aleph::FunctionalMixin< Derived, Type >::last_or(), TEST(), TEST(), TEST(), TEST(), and TEST().
Get the last element or a default value.
| default_val | Value to return if container is empty. |
Definition at line 1372 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::last(), and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inlinenoexcept |
Count the number of elements.
Definition at line 926 of file ah-dry-mixin.H.
References Aleph::count(), Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 695 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Transform elements using a mapping function.
Creates a new container with each element transformed by the operation. This is the classic "map" operation from functional programming.
| __Type | Result type (default: same as input Type). |
| Container | Result container type (default: DynList). |
| Operation | Callable with signature __Type(const Type&). |
| operation | Transformation function. |
Definition at line 681 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
Referenced by Aleph::FunctionalMixin< Derived, Type >::all(), Aleph::FunctionalMixin< Derived, Type >::all(), Aleph::FunctionalMixin< Derived, Type >::chunk(), Aleph::Cnode::clone(), Aleph::Cnode::clone(), Aleph::Cnode::contains(), Aleph::FunctionalMixin< Derived, Type >::count_if(), Aleph::FunctionalMixin< Derived, Type >::drop(), Aleph::FunctionalMixin< Derived, Type >::enumerate(), Aleph::FunctionalMixin< Derived, Type >::exists(), Aleph::FunctionalMixin< Derived, Type >::exists(), Aleph::Cnode::extract_word_from_stack(), Aleph::FunctionalMixin< Derived, Type >::filter(), Aleph::FunctionalMixin< Derived, Type >::filter(), Aleph::FunctionalMixin< Derived, Type >::find_index(), Aleph::FunctionalMixin< Derived, Type >::first(), Aleph::FunctionalMixin< Derived, Type >::first_or(), Aleph::FunctionalMixin< Derived, Type >::fold(), Aleph::FunctionalMixin< Derived, Type >::fold(), Aleph::FunctionalMixin< Derived, Type >::fold_left(), Aleph::FunctionalMixin< Derived, Type >::foldl(), Aleph::FunctionalMixin< Derived, Type >::for_each(), Aleph::FunctionalMixin< Derived, Type >::for_each(), Aleph::FunctionalMixin< Derived, Type >::for_each(), Aleph::FunctionalMixin< Derived, Type >::for_each(), Aleph::FunctionalMixin< Derived, Type >::forall(), Aleph::FunctionalMixin< Derived, Type >::forall(), Aleph::Cnode::insert_child(), Aleph::Cnode::insert_word(), Aleph::FunctionalMixin< Derived, Type >::intersperse(), Aleph::FunctionalMixin< Derived, Type >::join_str(), Aleph::FunctionalMixin< Derived, Type >::last(), Aleph::FunctionalMixin< Derived, Type >::last_or(), Aleph::FunctionalMixin< Derived, Type >::length(), Aleph::FunctionalMixin< Derived, Type >::maps(), Aleph::FunctionalMixin< Derived, Type >::maps(), Aleph::Cnode::mark_end_word(), Aleph::FunctionalMixin< Derived, Type >::max_by(), Aleph::FunctionalMixin< Derived, Type >::min_by(), Aleph::FunctionalMixin< Derived, Type >::mutable_for_each(), Aleph::FunctionalMixin< Derived, Type >::mutable_for_each(), Aleph::FunctionalMixin< Derived, Type >::none(), Aleph::FunctionalMixin< Derived, Type >::none(), Aleph::FunctionalMixin< Derived, Type >::partition(), Aleph::FunctionalMixin< Derived, Type >::partition(), Aleph::FunctionalMixin< Derived, Type >::pfilter(), Aleph::FunctionalMixin< Derived, Type >::pfilter(), Aleph::Cnode::print_words(), Aleph::FunctionalMixin< Derived, Type >::rev(), Aleph::Cnode::search_prefix(), Aleph::Cnode::search_word(), Aleph::FunctionalMixin< Derived, Type >::self(), Aleph::FunctionalMixin< Derived, Type >::self(), Aleph::FunctionalMixin< Derived, Type >::sliding(), Aleph::FunctionalMixin< Derived, Type >::take(), TEST(), TEST(), TEST(), Aleph::FunctionalMixin< Derived, Type >::to_dynlist(), Aleph::Cnode::to_str(), Aleph::FunctionalMixin< Derived, Type >::to_vector(), Aleph::FunctionalMixin< Derived, Type >::tpartition(), Aleph::FunctionalMixin< Derived, Type >::tpartition(), Aleph::FunctionalMixin< Derived, Type >::unique_by(), Aleph::Cnode::words(), Aleph::Cnode::words_with_prefix(), and Aleph::FunctionalMixin< Derived, Type >::zip_with().
|
inline |
Find the maximum element.
Definition at line 1129 of file ah-dry-mixin.H.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Find the maximum element using a custom comparator.
| Compare | Comparator type. |
| cmp | Comparator function (returns true if first < second). |
Definition at line 1188 of file ah-dry-mixin.H.
References cmp(), Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
Referenced by TEST().
|
inline |
Find the minimum element.
Definition at line 1101 of file ah-dry-mixin.H.
Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inline |
Find the minimum element using a custom comparator.
| Compare | Comparator type. |
| cmp | Comparator function (returns true if first < second). |
Definition at line 1159 of file ah-dry-mixin.H.
References cmp(), Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
Referenced by TEST().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 557 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Apply an operation to each element (mutable).
Like for_each() but allows modifying elements.
| Operation | Callable with signature void(Type&). |
| operation | The operation to apply (can modify elements). |
Definition at line 545 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps(), and Aleph::FunctionalMixin< Derived, Type >::self().
Referenced by TEST().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1255 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::exists(), Aleph::FunctionalMixin< Derived, Type >::maps(), and pred.
|
inline |
Check if no element satisfies a predicate.
| Predicate | Predicate type. |
| pred | Predicate function. |
Definition at line 1248 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::exists(), Aleph::FunctionalMixin< Derived, Type >::maps(), and pred.
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 884 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Partition elements by a predicate.
Splits the container into two lists: elements satisfying the predicate go into first, others go into second.
| Operation | Callable with signature bool(const Type&). |
| op | Predicate function. |
Definition at line 869 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
Referenced by TEST().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 847 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Filter with position information.
Like filter(), but returns tuples of (element, index) for matching elements.
| Operation | Callable with signature bool(const Type&). |
| operation | Predicate function. |
Definition at line 832 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
Compute the product of all elements.
| init | Initial value (default: Type{1} for numeric types). |
Definition at line 1074 of file ah-dry-mixin.H.
|
inline |
Create a reversed copy.
Definition at line 949 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
Referenced by TEST().
|
inlineprotectednoexcept |
Definition at line 460 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
Referenced by Aleph::FunctionalMixin< Derived, Type >::all(), Aleph::FunctionalMixin< Derived, Type >::drop(), Aleph::FunctionalMixin< Derived, Type >::exists(), Aleph::FunctionalMixin< Derived, Type >::find_index(), Aleph::FunctionalMixin< Derived, Type >::first(), Aleph::FunctionalMixin< Derived, Type >::for_each(), Aleph::FunctionalMixin< Derived, Type >::for_each(), Aleph::FunctionalMixin< Derived, Type >::mutable_for_each(), Aleph::FunctionalMixin< Derived, Type >::take(), Aleph::FunctionalMixin< Derived, Type >::to_vector(), and Aleph::FunctionalMixin< Derived, Type >::zip_with().
|
inlineprotectednoexcept |
Definition at line 465 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Create sliding windows of fixed size.
| size | Window size. |
| step | Step between windows (default: 1). |
Definition at line 1632 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::all(), Aleph::FunctionalMixin< Derived, Type >::for_each(), Aleph::FunctionalMixin< Derived, Type >::maps(), and Aleph::size().
Compute the sum of all elements.
| init | Initial value (default: Type{}). |
Definition at line 1046 of file ah-dry-mixin.H.
Take the first n elements.
| n | Maximum number of elements to take. |
Definition at line 980 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps(), and Aleph::FunctionalMixin< Derived, Type >::self().
Referenced by TEST().
|
inline |
Convert container to DynList.
Creates a DynList containing all elements in traversal order.
| DynListType | DynList type (default: DynList<Type>). |
Definition at line 1706 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Convert to std::vector.
Definition at line 1678 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::for_each(), Aleph::FunctionalMixin< Derived, Type >::maps(), and Aleph::FunctionalMixin< Derived, Type >::self().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 908 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Partition returning tuple instead of pair.
Definition at line 893 of file ah-dry-mixin.H.
References Aleph::DynList< T >::append(), Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
|
inline |
Remove consecutive duplicate elements.
Definition at line 1489 of file ah-dry-mixin.H.
Remove consecutive duplicates using a custom equality predicate.
| Container | Result container type (default: DynList). |
| EqPred | Equality predicate type. |
| eq | Predicate that returns true if two elements are equal. |
Definition at line 1524 of file ah-dry-mixin.H.
References Aleph::eq(), Aleph::FunctionalMixin< Derived, Type >::for_each(), and Aleph::FunctionalMixin< Derived, Type >::maps().
Referenced by TEST().
|
inline |
Zip with another container.
| Other | The other container type. |
| Container | Result container type (default: DynList). |
| other | The container to zip with. |
Definition at line 1800 of file ah-dry-mixin.H.
References Aleph::FunctionalMixin< Derived, Type >::maps(), and Aleph::FunctionalMixin< Derived, Type >::self().