ret new;
}
+/*
+Function: connect
+
+Concatenate a vector of vectors, placing a given separator between each
+*/
+fn connect<T: copy>(v: [const [const T]], sep: T) -> [T] {
+ let new: [T] = [];
+ let first = true;
+ for inner: [T] in v {
+ if first { first = false; } else { push(new, sep); }
+ new += inner;
+ }
+ ret new;
+}
+
/*
Function: foldl
assert concat([[1], [2,3]]) == [1, 2, 3];
}
+ #[test]
+ fn test_connect() {
+ assert connect([], 0) == [];
+ assert connect([[1], [2, 3]], 0) == [1, 0, 2, 3];
+ assert connect([[1], [2], [3]], 0) == [1, 0, 2, 0, 3];
+ }
+
#[test]
fn test_windowed () {
assert [[1u,2u,3u],[2u,3u,4u],[3u,4u,5u],[4u,5u,6u]]