diff options
| author | Patrick Walton <[email protected]> | 2011-03-18 15:19:32 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-03-18 15:19:32 -0700 |
| commit | 9ad9d3783dd1d2ac4962b03ba63d0a1ed4d8c00f (patch) | |
| tree | 96b7fdd9f2b43053f3d0b3d3426e27bb818ac76a /src | |
| parent | rustc: Box the tuples returned by hashmap.items() for now since we don't have... (diff) | |
| download | rust-9ad9d3783dd1d2ac4962b03ba63d0a1ed4d8c00f.tar.xz rust-9ad9d3783dd1d2ac4962b03ba63d0a1ed4d8c00f.zip | |
rustc: Fix list.foldl() to pass its second argument by alias
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/list.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/list.rs b/src/lib/list.rs index 58c2cded..33f7c060 100644 --- a/src/lib/list.rs +++ b/src/lib/list.rs @@ -10,7 +10,7 @@ tag list[T] { nil; } -fn foldl[T,U](&list[T] ls, &U u, fn(&T t, U u) -> U f) -> U { +fn foldl[T,U](&list[T] ls, &U u, fn(&T t, &U u) -> U f) -> U { alt(ls) { case (cons[T](?hd, ?tl)) { auto u_ = f(hd, u); @@ -50,7 +50,7 @@ fn find[T,U](&list[T] ls, } fn length[T](&list[T] ls) -> uint { - fn count[T](&T t, uint u) -> uint { + fn count[T](&T t, &uint u) -> uint { ret u + 1u; } ret foldl[T,uint](ls, 0u, bind count[T](_, _)); |