core: Demode option

This commit is contained in:
Brian Anderson
2012-09-21 19:37:57 -07:00
parent 92752a462a
commit 4a78f9b166
81 changed files with 325 additions and 313 deletions

View File

@@ -957,7 +957,7 @@ pure fn find<T: Copy>(v: &[T], f: fn(T) -> bool) -> Option<T> {
*/
pure fn find_between<T: Copy>(v: &[T], start: uint, end: uint,
f: fn(T) -> bool) -> Option<T> {
option::map(position_between(v, start, end, f), |i| v[i])
position_between(v, start, end, f).map(|i| v[i])
}
/**
@@ -980,7 +980,7 @@ pure fn rfind<T: Copy>(v: &[T], f: fn(T) -> bool) -> Option<T> {
*/
pure fn rfind_between<T: Copy>(v: &[T], start: uint, end: uint,
f: fn(T) -> bool) -> Option<T> {
option::map(rposition_between(v, start, end, f), |i| v[i])
rposition_between(v, start, end, f).map(|i| v[i])
}
/// Find the first index containing a matching value