This document aims to describe the file structure and contents of this project.
The root directory contains the itplus.h
header file, which is a single header version of the full library. It contains every header present in include.
The include directory contains all the header files for the iterplus
interface library.
File | Description |
---|---|
|
Macros for implementing the An IterChain struct is a struct that stores 2 iterables, and starts consuming from the other one once one of them has been fully consumed. Essentially chaining together the 2 iterables. |
|
Macros for implementing the Note: Rust's |
|
Helpers for implementing all iterplus utilities at once, for given type. |
|
Macros for implementing the An IterDrop struct is a struct that keeps track of how many elements have been dropped out of an iterator as well as a limit to start extracting the elements at - the iterator impl for this struct will keep dropping from an iterator until it hits that limit, or until the source iterable gets exhausted, whichever comes first. Once enough elements have been dropped, it'll start extracting and returning the rest of the elements. |
|
Macros for implementing the An IterDropWhile struct is a struct that stores a source iterable, a predicate function, and a flag to indicate when to stop testing with the predicate function. It keeps dropping from the source iterable until the predicate returns false, and starts returning the elements from the iterators from there on. |
|
Macros for implementing the An IterEnumr struct is a struct that stores an iterable, and its iteration index. Its |
|
Macros for implementing the An IterFilt struct is a struct that stores a filtering function within it, as well as the source iterable. |
|
Macros for implementing the An IterFiltMap struct is a struct that stores a filter-mapping function within it, as well as the source iterable. The filter-mapping function is just a function that returns a Maybe(T). A |
|
Macros for implementing the |
|
Definition of the |
|
Utilities to define and implement an Iterable. |
|
General utility macros. |
|
Macros for implementing the An IterMap struct is a struct that stores a mapping function within it, as well as the source iterable. |
|
Utilities to define and use a Maybe type. An IterMap struct is a struct that stores a mapping function within it, as well as the source iterable. |
|
Utilities to define and use a Pair type. A Tuple of 2 elements. |
|
Macros for implementing the |
|
Macros for implementing the An IterTake struct is a struct that keeps track of how many elements have been extracted out of an iterator as well as a limit to stop at - the iterator impl for this struct will keep consuming from an iterator until it hits that limit, or until the source iterable gets exhausted, whichever comes first. |
|
Macros for implementing the An IterTakeWhile struct is a struct that stores a source iterable, a predicate function, and a flag to indicate when to stop testing with the predicate function. It keeps consuming from the source iterable, and stops once the predicate returns false. |
|
Utilities to define a typeclass and its instance. |
|
Macros for implementing the An IterZip struct is a struct that stores 2 iterables, and has a |
The tests/
directory contains usage tests (essentially examples) for the library.
File | Description |
---|---|
|
Declarations of iterator and iterplus structs used in the test executable. |
|
Declarations of utilities, structs, and functions for which iterator and iterplus utilities have been implemented. |
|
Implementations of iterables and iterplus utilities. |
|
The main test executable using all the iterplus utilities. |
|
Macro to map over a given function/macro over VA_ARGS - supports upto 8 arguments. |
|
"Syntactic sugar". Convenience macros for using the iterplus utilities. The examples use C11's Essentially, wrapper functions are defined, which take a pre-allocated iterplus struct (of a specific type), the iterable to put into said struct (and other stuff if necessary), and return an Iterable corresponding to that iterplus struct. These wrapper functions are defined in The structure pre-allocation and passing to this functions is done in the |
|
Wrapper functions to fill pre-allocated iterplus structs of specific types, and turn them into Iterables. |
This is more or less a subset of tests. It contains examples of solving 2 problems-
- Finding longest common prefix of a string array
- Calculating the dot product of 2 arrays and then summing it.