Error checking for protocols. We'll need spans though.
This commit is contained in:
parent
156eceb24a
commit
c8739cb0bc
7 changed files with 274 additions and 141 deletions
|
@ -23,6 +23,29 @@ impl extensions <T:copy, U:copy> for (T, U) {
|
|||
|
||||
}
|
||||
|
||||
impl extensions<A: copy, B: copy> for (&[A], &[B]) {
|
||||
fn zip() -> ~[(A, B)] {
|
||||
let (a, b) = self;
|
||||
vec::zip(a, b)
|
||||
}
|
||||
|
||||
fn map<C>(f: fn(A, B) -> C) -> ~[C] {
|
||||
let (a, b) = self;
|
||||
vec::map2(a, b, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl extensions<A: copy, B: copy> for (~[A], ~[B]) {
|
||||
fn zip() -> ~[(A, B)] {
|
||||
let (a, b) = self;
|
||||
vec::zip(a, b)
|
||||
}
|
||||
|
||||
fn map<C>(f: fn(A, B) -> C) -> ~[C] {
|
||||
let (a, b) = self;
|
||||
vec::map2(a, b, f)
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tuple() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue