about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-09-28 18:11:22 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-09-28 21:52:32 -0700
commitf1014c43fd4e22fa1a8190e642e05dc6891d6eaa (patch)
tree7d8bb3ba1bdd99b2491da1df6d3f869e8b7481ef /src/libcore
parentd0333a8e414e510dace81c4d6fc40a0c77c11ea7 (diff)
downloadrust-f1014c43fd4e22fa1a8190e642e05dc6891d6eaa.tar.gz
rust-f1014c43fd4e22fa1a8190e642e05dc6891d6eaa.zip
Finish demoding iter: from_elem, copy_seq, map, append
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/iter.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 77b9a3ce8fb..ebc768931b5 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -248,10 +248,10 @@ pure fn build_sized_opt<A,B: Buildable<A>>(
 // Functions that combine iteration and building
 
 /// Apply a function to each element of an iterable and return the results
-fn map<T,IT: BaseIter<T>,U,BU: Buildable<U>>(v: IT, f: fn(T) -> U) -> BU {
+fn map<T,IT: BaseIter<T>,U,BU: Buildable<U>>(v: &IT, f: fn(&T) -> U) -> BU {
     do build_sized_opt(v.size_hint()) |push| {
         for v.each() |elem| {
-            push(f(*elem));
+            push(f(elem));
         }
     }
 }
@@ -275,17 +275,17 @@ pure fn from_fn<T,BT: Buildable<T>>(n_elts: uint, op: InitOp<T>) -> BT {
  * Creates an immutable vector of size `n_elts` and initializes the elements
  * to the value `t`.
  */
-pure fn from_elem<T: Copy,BT: Buildable<T>>(n_elts: uint, t: T) -> BT {
+pure fn from_elem<T: Copy,BT: Buildable<T>>(n_elts: uint, +t: T) -> BT {
     do build_sized(n_elts) |push| {
-        let mut i: uint = 0u;
-        while i < n_elts { push(t); i += 1u; }
+        let mut i: uint = 0;
+        while i < n_elts { push(t); i += 1; }
     }
 }
 
 /// Appending two generic sequences
 #[inline(always)]
 pure fn append<T: Copy,IT: BaseIter<T>,BT: Buildable<T>>(
-    lhs: IT, rhs: IT) -> BT {
+    lhs: &IT, rhs: &IT) -> BT {
     let size_opt = lhs.size_hint().chain_ref(
         |sz1| rhs.size_hint().map(|sz2| *sz1+*sz2));
     do build_sized_opt(size_opt) |push| {
@@ -298,7 +298,7 @@ pure fn append<T: Copy,IT: BaseIter<T>,BT: Buildable<T>>(
 /// type of sequence.
 #[inline(always)]
 pure fn copy_seq<T: Copy,IT: BaseIter<T>,BT: Buildable<T>>(
-    v: IT) -> BT {
+    v: &IT) -> BT {
     do build_sized_opt(v.size_hint()) |push| {
         for v.each |x| { push(*x); }
     }