aboutsummaryrefslogtreecommitdiff
path: root/src/list
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-02-26 19:06:34 +0100
committerAdrian Kummerlaender2015-02-26 19:06:34 +0100
commit34530d8532e22afe0026b956ae395ddc666351b3 (patch)
treeea3f2f99c8fe60f3a70213c0f1fa294aabff0237 /src/list
parente26621df352272688834361e7d026338cefb1372 (diff)
downloadTypeAsValue-34530d8532e22afe0026b956ae395ddc666351b3.tar
TypeAsValue-34530d8532e22afe0026b956ae395ddc666351b3.tar.gz
TypeAsValue-34530d8532e22afe0026b956ae395ddc666351b3.tar.bz2
TypeAsValue-34530d8532e22afe0026b956ae395ddc666351b3.tar.lz
TypeAsValue-34530d8532e22afe0026b956ae395ddc666351b3.tar.xz
TypeAsValue-34530d8532e22afe0026b956ae395ddc666351b3.tar.zst
TypeAsValue-34530d8532e22afe0026b956ae395ddc666351b3.zip
Enabled `Concatenate` to concatenate a variadic pack of lists
* analogously to arbitrary list count concatenation in Scheme's `append` ** implemented for `Concatenate` instead as it fits better with the structure between `Append` and `Concatenate`
Diffstat (limited to 'src/list')
-rw-r--r--src/list/operation/concatenate.h13
-rw-r--r--src/list/operation/higher/sort.h8
2 files changed, 13 insertions, 8 deletions
diff --git a/src/list/operation/concatenate.h b/src/list/operation/concatenate.h
index a5cbaa6..cf680c1 100644
--- a/src/list/operation/concatenate.h
+++ b/src/list/operation/concatenate.h
@@ -2,16 +2,23 @@
#define TYPEASVALUE_SRC_LIST_OPERATION_CONCATENATE_H_
#include "append.h"
-#include "higher/remove.h"
#include "higher/fold.h"
+#include "conditional/if.h"
namespace tav {
-template <typename ListOfLists>
+template <
+ typename Head,
+ typename... Tail
+>
using Concatenate = Fold<
Append,
void,
- ListOfLists
+ If<
+ Boolean<sizeof...(Tail) == 0>,
+ Head,
+ List<Head, Tail...>
+ >
>;
}
diff --git a/src/list/operation/higher/sort.h b/src/list/operation/higher/sort.h
index 925ab89..51317fa 100644
--- a/src/list/operation/higher/sort.h
+++ b/src/list/operation/higher/sort.h
@@ -29,11 +29,9 @@ class quick_sort {
public:
using type = Concatenate<
- List<
- Eval<quick_sort<Comparator, lhs>>,
- List<pivot>,
- Eval<quick_sort<Comparator, rhs>>
- >
+ Eval<quick_sort<Comparator, lhs>>,
+ List<pivot>,
+ Eval<quick_sort<Comparator, rhs>>
>;
};