]> git.lizzy.rs Git - rust.git/commitdiff
old_iter: rm the min/max free functions
authorDaniel Micay <danielmicay@gmail.com>
Sat, 15 Jun 2013 23:24:20 +0000 (19:24 -0400)
committerDaniel Micay <danielmicay@gmail.com>
Sun, 16 Jun 2013 02:16:22 +0000 (22:16 -0400)
src/libstd/old_iter.rs

index 39f3a81ad218f49cc15a7da6b900b58031ebdcdb..347b477442287c8f85161c79c1cba7439806d435 100644 (file)
@@ -187,40 +187,6 @@ pub fn position<A,IA:BaseIter<A>>(this: &IA, f: &fn(&A) -> bool)
     return None;
 }
 
-// note: 'rposition' would only make sense to provide with a bidirectional
-// iter interface, such as would provide "reach" in addition to "each". As is,
-// it would have to be implemented with foldr, which is too inefficient.
-
-#[inline(always)]
-pub fn min<A:Copy + Ord,IA:BaseIter<A>>(this: &IA) -> A {
-    match do foldl::<A,Option<A>,IA>(this, None) |a, b| {
-        match a {
-          &Some(ref a_) if *a_ < *b => {
-             *(a)
-          }
-          _ => Some(*b)
-        }
-    } {
-        Some(val) => val,
-        None => fail!("min called on empty iterator")
-    }
-}
-
-#[inline(always)]
-pub fn max<A:Copy + Ord,IA:BaseIter<A>>(this: &IA) -> A {
-    match do foldl::<A,Option<A>,IA>(this, None) |a, b| {
-        match a {
-          &Some(ref a_) if *a_ > *b => {
-              *(a)
-          }
-          _ => Some(*b)
-        }
-    } {
-        Some(val) => val,
-        None => fail!("max called on empty iterator")
-    }
-}
-
 #[inline(always)]
 pub fn find<A:Copy,IA:BaseIter<A>>(this: &IA, f: &fn(&A) -> bool)
                                 -> Option<A> {