aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/list/operation/higher/query.h9
-rw-r--r--src/operation/logic.h3
-rw-r--r--test.cc22
3 files changed, 34 insertions, 0 deletions
diff --git a/src/list/operation/higher/query.h b/src/list/operation/higher/query.h
index 56bb203..34d05cb 100644
--- a/src/list/operation/higher/query.h
+++ b/src/list/operation/higher/query.h
@@ -1,6 +1,7 @@
#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_QUERY_H_
#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_QUERY_H_
+#include "fold.h"
#include "operation/logic.h"
namespace tav {
@@ -25,6 +26,14 @@ using All = Fold<
typename Map<Function, List>::type
>;
+template <
+ template<typename> class Function,
+ typename List
+>
+using None = Not<
+ typename Any<Function, List>::type
+>;
+
}
#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_QUERY_H_
diff --git a/src/operation/logic.h b/src/operation/logic.h
index 23393b2..3e447d6 100644
--- a/src/operation/logic.h
+++ b/src/operation/logic.h
@@ -23,6 +23,9 @@ template <
>
using Xor = Boolean<X::value ^ Y::value>;
+template <typename X>
+using Not = Boolean<!X::value>;
+
}
#endif // TYPEASVALUE_SRC_OPERATION_LOGIC_H_
diff --git a/test.cc b/test.cc
index 3457a60..f64e385 100644
--- a/test.cc
+++ b/test.cc
@@ -443,3 +443,25 @@ static_assert(
>::value,
"(all odd? (list 1 2 3)) != #f"
);
+
+static_assert(
+ std::is_same<
+ tav::Boolean<true>,
+ tav::None<
+ tav::Even,
+ tav::List<tav::Int<1>, tav::Int<3>, tav::Int<5>>::type
+ >::type
+ >::value,
+ "(none even? (list 1 3 5)) != #t"
+);
+
+static_assert(
+ std::is_same<
+ tav::Boolean<false>,
+ tav::None<
+ tav::Even,
+ tav::List<tav::Int<2>, tav::Int<3>, tav::Int<5>>::type
+ >::type
+ >::value,
+ "(none even? (list 2 3 5)) != #f"
+);