stdlib: Rename list::length to list::len to match vec::len

This commit is contained in:
Brian Anderson 2011-10-28 13:37:19 -07:00
parent 2e8a8390d5
commit 49e8ffa34f
2 changed files with 4 additions and 4 deletions

View File

@ -95,11 +95,11 @@ fn has<T>(ls: list<T>, elt: T) -> bool {
} }
/* /*
Function: length Function: len
Returns the length of a list Returns the length of a list
*/ */
fn length<T>(ls: list<T>) -> uint { fn len<T>(ls: list<T>) -> uint {
fn count<T>(_t: T, &&u: uint) -> uint { ret u + 1u; } fn count<T>(_t: T, &&u: uint) -> uint { ret u + 1u; }
ret foldl(ls, 0u, bind count(_, _)); ret foldl(ls, 0u, bind count(_, _));
} }

View File

@ -59,8 +59,8 @@ fn test_has() {
} }
#[test] #[test]
fn test_length() { fn test_len() {
let l = from_vec([0, 1, 2]); let l = from_vec([0, 1, 2]);
assert (list::length(l) == 3u); assert (list::len(l) == 3u);
} }