A standard, garbage-collected linked list.

Enum List

Variants

Enum MutList

Variants

Implementation of ::std::cmp::Eq for List<T> where <T: ::std::cmp::Eq>

Automatically derived.

Method eq

fn eq(&self, __arg_0: &List<T>) -> ::bool

Method ne

fn ne(&self, __arg_0: &List<T>) -> ::bool

Implementation of ::std::cmp::Eq for MutList<T> where <T: ::std::cmp::Eq>

Automatically derived.

Method eq

fn eq(&self, __arg_0: &MutList<T>) -> ::bool

Method ne

fn ne(&self, __arg_0: &MutList<T>) -> ::bool

Implementation for MutList<T> where <T>

Method each

fn each(@mut self, f: &fn(&mut T) -> bool) -> bool

Iterate over a mutable list

Function append

fn append<T: Copy>(l: @List<T>, m: @List<T>) -> @List<T>

Appends one list to another

Function each

fn each<T>(l: @List<T>, f: &fn(&T) -> bool) -> bool

Iterate over a list

Function find

fn find<T: Copy>(ls: @List<T>, f: &fn(&T) -> bool) -> Option<T>

Search for an element that matches a given predicate

Apply function f to each element of v, starting from the first. When function f returns true then an option containing the element is returned. If f matches no elements then none is returned.

Function foldl

fn foldl<T: Copy, U>(z: T, ls: @List<U>, f: &fn(&T, &U) -> T) -> T

Left fold

Applies f to u and the first element in the list, then applies f to the result of the previous call and the second element, and so on, returning the accumulated result.

Arguments

Function from_vec

fn from_vec<T: Copy>(v: &[T]) -> @List<T>

Create a list from a vector

Function has

fn has<T: Copy + Eq>(ls: @List<T>, elt: T) -> bool

Returns true if a list contains an element with the given value

Function head

fn head<T: Copy>(ls: @List<T>) -> T

Returns the first element of a list

Function is_empty

fn is_empty<T: Copy>(ls: @List<T>) -> bool

Returns true if the list is empty

Function iter

fn iter<T>(l: @List<T>, f: &fn(&T))

Iterate over a list

Function len

fn len<T>(ls: @List<T>) -> uint

Returns the length of a list

Function tail

fn tail<T: Copy>(ls: @List<T>) -> @List<T>

Returns all but the first element of a list