Function fplist::one[][src]

pub fn one<T>(elem: T) -> PersistentList<T>
Expand description

Creates a new list with one element.

Shorthand for cons(elem, PersistentList::new()).

use fplist::one;

let x = one(42);

assert_eq!(x.first(), Some(&42));
assert_eq!(x.len(), 1);