45#include <gtest/gtest.h>
67 std::vector<int> v = {1, 2, 3, 4, 5};
77 std::vector<int> v = {1, 2, 3, 4, 5, 6};
87 std::vector<int> v = {1, 2, 3, 4, 5};
94 std::vector<int> v = {2, 4, 6, 8};
100 std::vector<int> v = {1, 2, 3, 4, 5};
182 std::vector<int>
stl = {1, 2, 3, 4, 5};
193 std::vector<int>
stl = {1, 2, 3, 4, 5, 6};
204 std::vector<int>
stl = {1, 2, 3, 4, 5};
220 std::vector<std::string>
stl = {
"a",
"b",
"c"};
224 return std::to_string(i) + s;
228 return std::to_string(i) + s;
238 std::vector<int>
stl = {10, 20, 30, 40, 50};
250 std::vector<int>
stl = {1, 2, 3, 4};
268 std::vector<int>
stl = {1, 2, 3, 4, 5};
282 std::vector<std::string>
stl = {
"a",
"b",
"c",
"d"};
296 std::vector<int>
stl = {1, 2, 3, 4, 5};
311 std::vector<int>
stl = {1, 2, 3, 4, 5, 6};
323 std::vector<int>
stl = {1, 2, 3, 4, 5};
336 std::vector<int>
stl = {1, 2, 3, 4, 5};
349 std::vector<int>
stl = {1, 2, 3, 4, 5};
362 std::vector<int>
stl = {1, 2, 3, 10, 4, 5};
374 std::vector<int>
stl = {1, 2, 3, 10, 4, 5};
391 std::vector<int>
stl = {10, 20, 30};
405 std::vector<int>
stl = {10, 20, 30};
419 std::vector<int>
stl = {10, 20, 30, 40, 50};
437 std::vector<int>
stl = {3, 1, 4, 1, 5, 9};
451 std::vector<int>
stl = {3, 1, 4, 1, 5, 9};
465 std::vector<int>
stl = {3, 1, 4, 1, 5, 9};
485 std::vector<int>
stl = {1, 2, 3, 4, 5};
494 std::vector<int>
stl = {1, 2, 3, 4};
507 std::vector<int>
stl = {1, 2, 3, 4, 5, 6};
540 std::vector<int>
stl = {1, 2, 3};
550 std::vector<int>
stl = {1, 2, 3};
566 std::list<int>
l = {1, 2, 3, 4, 5};
575 std::deque<int> d = {1, 2, 3, 4, 5, 6};
587 std::vector<int> empty;
615 std::vector<int>
stl = {42};
627 ::testing::InitGoogleTest(&
argc,
argv);
Unified functional programming utilities for both STL and Aleph containers.
T & append()
Allocate a new entry to the end of array.
Dynamic doubly linked list with O(1) size and bidirectional access.
Dynamic singly linked list with functional programming support.
T & append(const T &item)
Append a new item by copy.
void empty() noexcept
empty the list
size_t size() const noexcept
Count the number of elements of the list.
Singly linked list implementations with head-tail access.
Main namespace for Aleph-w library functions.
auto stl_first(const Container &c)
Get first element.
auto uni_filter(Pred &&pred, const Container &c)
Filter elements satisfying predicate.
auto uni_nth(size_t n, const Container &c)
Get n-th element.
auto stl_last(const Container &c)
Get last element.
auto stl_max(const Container &c)
Get maximum element.
int uni_compare(const Container1 &c1, const Container2 &c2)
Compare two containers lexicographically.
bool uni_equal(const Container1 &c1, const Container2 &c2)
Check equality of two containers.
std::vector< T > uni_scan_left(T init, Op &&op, const Container &c)
Scan left - fold with all intermediate results.
size_t uni_length(const Container &c)
Get container length.
auto stl_nth(const size_t n, const Container &c)
Get n-th element.
auto uni_drop_while(Pred &&pred, const Container &c)
Drop elements while predicate is true, return the rest.
auto uni_product(const Container &c)
Product of all elements.
auto uni_find(Pred &&pred, const Container &c)
Find first element satisfying predicate.
bool uni_mem(const T &target, const Container &c)
Check if element exists in container (mem in ML).
auto uni_filteri(Pred &&pred, const Container &c)
Filter with index (filteri in ML).
auto uni_map(Op &&op, const Container &c)
Map operation - transform each element.
size_t stl_count(Pred &&pred, const Container &c)
Count elements satisfying predicate.
auto stl_sum(const Container &c)
Sum all elements.
auto uni_last(const Container &c)
Get last element.
auto uni_min_max(const Container &c)
Get both min and max in a single pass.
auto uni_min(const Container &c)
Get minimum element.
size_t uni_count(Pred &&pred, const Container &c)
Count elements satisfying predicate.
auto stl_min(const Container &c)
Get minimum element.
T uni_foldl(T init, Op &&op, const Container &c)
Left fold (foldl) - reduce from left to right.
auto uni_drop(size_t n, const Container &c)
Drop first n elements, return the rest.
auto uni_max(const Container &c)
Get maximum element.
auto uni_take_while(Pred &&pred, const Container &c)
Take elements while predicate is true.
bool uni_all(Pred &&pred, const Container &c)
Check if all elements satisfy predicate.
auto uni_first(const Container &c)
Get first element.
auto uni_partition(Pred &&pred, const Container &c)
Partition elements by predicate.
auto uni_to_vector(const Container &c)
Convert container to std::vector.
auto uni_mapi(Op &&op, const Container &c)
Map with index (mapi in ML).
auto uni_take(size_t n, const Container &c)
Take first n elements.
auto uni_sum(const Container &c)
Sum all elements.
bool uni_exists(Pred &&pred, const Container &c)
Check if any element satisfies predicate.
DynList< T > maps(const C &c, Op op)
Classic map operation.
T sum(const Container &container, const T &init=T{})
Compute sum of all elements.
std::optional< size_t > uni_find_index(Pred &&pred, const Container &c)
Find index of first element satisfying predicate.
Lazy and scalable dynamic array implementation.
Dynamic doubly linked list implementation.