aboutsummaryrefslogtreecommitdiff
path: root/src/utility/predicate.h
AgeCommit message (Collapse)Author
2015-02-24Replaced `utility::defer_eval` with placeholder-less `Apply`Adrian Kummerlaender
* usage of `Apply` sans placeholders was already possible and as such duplicated `utility::defer_eval` * renamed `apply_none`'s type alias from to `type` to enable combining it with `Eval`
2015-02-19Reimplemented `Find` in terms of `ListIndex`Adrian Kummerlaender
* `ListIndex` already implements the necessary partial template specializations for finding elements matching a predicate * reimplemented `Cond` using `detail::find_variadic` as `Find` depends on `Apply` which in turn depends on `Cond` ** it is useful if core functionality such as the branched conditional `Cond` do not require higher order functionality such as `Find` *** otherwise one can not use core functionality in the implementation of higher order functionality * introduced `utility::predicate_guard` helper template ** checks a given value using a predicate and only forwards the value to the guarded function if this check is successful ** if check is unsuccessful it returns a surrogate value simmilar to `utility::predicate_assurance`
2015-02-17Reimplemented `TakeWhile` and `DropWhile` in terms of `ListIndex`Adrian Kummerlaender
* new higher order list operation `ListIndex` returns the index of the first list element satisfying a given predicate function ** this enables finding the split index required for both `TakeWhile` and `DropWhile` ** actual list manipulation is then performed using lower order `Take` or `Drop` ** analogously to `list-index` in SRFI-1 ** added appropriate test case * added higher order predicate utility function `utility::predicate_assurance` ** as its name implies this function enables assuring that a value satisfies a given predicate *** if this is not the case a surrogate value is returned instead ** this is used to return a appropriate size value if the `ListIndex` call fails because no element satisfies its predicate ** `detail::predicate_negator` was moved from `Remove`'s implementation details into the newly introduced `utility` namespace *** as it is required by both `TakeWhile` and `DropWhile` in addition to `Remove` * continuation of 8e49cc6