aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/list/generator/higher/list_tabulate.h2
-rw-r--r--src/list/operation/higher/filter.h34
-rw-r--r--src/list/operation/higher/map.h33
-rw-r--r--src/list/operation/higher/misc.h56
-rw-r--r--src/list/operation/higher/query.h2
-rw-r--r--test.cc3
6 files changed, 71 insertions, 59 deletions
diff --git a/src/list/generator/higher/list_tabulate.h b/src/list/generator/higher/list_tabulate.h
index 9eee599..dd2914a 100644
--- a/src/list/generator/higher/list_tabulate.h
+++ b/src/list/generator/higher/list_tabulate.h
@@ -2,7 +2,7 @@
#define TYPEASVALUE_SRC_LIST_GENERATOR_HIGHER_LIST_TABULATE_H_
#include "list/generator/iota.h"
-#include "list/operation/higher/misc.h"
+#include "list/operation/higher/map.h"
namespace tav {
diff --git a/src/list/operation/higher/filter.h b/src/list/operation/higher/filter.h
new file mode 100644
index 0000000..8788aed
--- /dev/null
+++ b/src/list/operation/higher/filter.h
@@ -0,0 +1,34 @@
+#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FILTER_H_
+#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FILTER_H_
+
+#include "fold.h"
+#include "conditional/if.h"
+
+namespace tav {
+
+template <
+ template<typename> class Function,
+ typename List
+>
+class Filter {
+ private:
+ template <
+ typename Current,
+ typename Previous
+ >
+ struct function_wrapper {
+ typedef If<
+ Function<Current>::type::value,
+ Cons<Current, Previous>,
+ Previous
+ > type;
+ };
+
+ public:
+ typedef typename Fold<function_wrapper, void, List>::type type;
+
+};
+
+}
+
+#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_FILTER_H_
diff --git a/src/list/operation/higher/map.h b/src/list/operation/higher/map.h
new file mode 100644
index 0000000..1c577ca
--- /dev/null
+++ b/src/list/operation/higher/map.h
@@ -0,0 +1,33 @@
+#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MAP_H_
+#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MAP_H_
+
+#include "fold.h"
+#include "conditional/if.h"
+
+namespace tav {
+
+template <
+ template<typename> class Function,
+ typename List
+>
+class Map {
+ private:
+ template <
+ typename Current,
+ typename Previous
+ >
+ struct function_wrapper {
+ typedef Cons<
+ typename Function<Current>::type,
+ Previous
+ > type;
+ };
+
+ public:
+ typedef typename Fold<function_wrapper, void, List>::type type;
+
+};
+
+}
+
+#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MAP_H_
diff --git a/src/list/operation/higher/misc.h b/src/list/operation/higher/misc.h
deleted file mode 100644
index feec7de..0000000
--- a/src/list/operation/higher/misc.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MISC_H_
-#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MISC_H_
-
-#include "fold.h"
-#include "conditional/if.h"
-
-namespace tav {
-
-template <
- template<typename> class Function,
- typename List
->
-class Map {
- private:
- template <
- typename Current,
- typename Previous
- >
- struct function_wrapper {
- typedef Cons<
- typename Function<Current>::type,
- Previous
- > type;
- };
-
- public:
- typedef typename Fold<function_wrapper, void, List>::type type;
-
-};
-
-template <
- template<typename> class Function,
- typename List
->
-class Filter {
- private:
- template <
- typename Current,
- typename Previous
- >
- struct function_wrapper {
- typedef If<
- Function<Current>::type::value,
- Cons<Current, Previous>,
- Previous
- > type;
- };
-
- public:
- typedef typename Fold<function_wrapper, void, List>::type type;
-
-};
-
-}
-
-#endif // TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_MISC_H_
diff --git a/src/list/operation/higher/query.h b/src/list/operation/higher/query.h
index c6eabc7..198ffa5 100644
--- a/src/list/operation/higher/query.h
+++ b/src/list/operation/higher/query.h
@@ -2,7 +2,7 @@
#define TYPEASVALUE_SRC_LIST_OPERATION_HIGHER_QUERY_H_
#include "fold.h"
-#include "misc.h"
+#include "map.h"
#include "operation/math.h"
#include "operation/logic.h"
diff --git a/test.cc b/test.cc
index cf99e8e..e7817f0 100644
--- a/test.cc
+++ b/test.cc
@@ -7,7 +7,8 @@
#include "list/list.h"
#include "list/operation/reverse.h"
#include "list/operation/contains.h"
-#include "list/operation/higher/misc.h"
+#include "list/operation/higher/map.h"
+#include "list/operation/higher/filter.h"
#include "list/operation/higher/query.h"
#include "list/generator/iota.h"
#include "list/generator/make_list.h"