// -*- rust -*- fn main() { let int sum = 0; for each (int i in first_ten()) { log "main"; log i; sum = sum + i; } log "sum"; log sum; check (sum == 45); } iter first_ten() -> int { let int i = 0; while (i < 10) { log "first_ten"; put i; i = i + 1; } } // -*- rust -*- fn main() { let int sum = 0; for each (int i in first_ten()) { log "main"; log i; sum = sum + i; } log "sum"; log sum; assert (sum == 45); } iter first_ten() -> int { let int i = 0; while (i < 10) { log "first_ten"; put i; i = i + 1; } } // -*- rust -*- fn main() { let int sum = 0; for each (int i in first_ten()) { log "main"; log i; sum = sum + i; } log "sum"; log sum; check (sum == 45); } iter first_ten() -> int { let int i = 0; while (i < 10) { log "first_ten"; put i; i = i + 1; } } // -*- rust -*- fn main() { let int sum = 0; for each (int i in first_ten()) { log "main"; log i; sum = sum + i; } log "sum"; log sum; assert (sum == 45); } iter first_ten() -> int { let int i = 0; while (i < 10) { log "first_ten"; put i; i = i + 1; } } // -*- rust -*- fn main() { let int sum = 0; for each (int i in first_ten()) { log "main"; log i; sum = sum + i; } log "sum"; log sum; assert (sum == 45); } iter first_ten() -> int { let int i = 0; while (i < 10) { log "first_ten"; put i; i = i + 1; } } // -*- rust -*- fn main() { let sum: int = 0; for each i: int in first_ten() { log "main"; log i; sum = sum + i; } log "sum"; log sum; assert (sum == 45); } iter first_ten() -> int { let i: int = 0; while i < 10 { log "first_ten"; put i; i = i + 1; } } // -*- rust -*- fn main() { let sum: int = 0; for each i: int in first_ten() { log "main"; log i; sum = sum + i; } log "sum"; log sum; assert (sum == 45); } iter first_ten() -> int { let i: int = 0; while i < 10 { log "first_ten"; put i; i = i + 1; } } // -*- rust -*- fn main() { let sum: int = 0; first_ten {|i| log "main"; log i; sum = sum + i; }; log "sum"; log sum; assert (sum == 45); } fn first_ten(it: block(int)) { let i: int = 0; while i < 10 { log "first_ten"; it(i); i = i + 1; } } // -*- rust -*- fn main() { let sum: int = 0; first_ten {|i| #debug("main"); log_full(core::debug, i); sum = sum + i; }; #debug("sum"); log_full(core::debug, sum); assert (sum == 45); } fn first_ten(it: block(int)) { let i: int = 0; while i < 10 { #debug("first_ten"); it(i); i = i + 1; } } // -*- rust -*- fn main() { let sum: int = 0; first_ten {|i| #debug("main"); log(debug, i); sum = sum + i; }; #debug("sum"); log(debug, sum); assert (sum == 45); } fn first_ten(it: block(int)) { let i: int = 0; while i < 10 { #debug("first_ten"); it(i); i = i + 1; } } // -*- rust -*- fn main() { let sum: int = 0; first_ten {|i| #debug("main"); log(debug, i); sum = sum + i; }; #debug("sum"); log(debug, sum); assert (sum == 45); } fn first_ten(it: fn(int)) { let i: int = 0; while i < 10 { #debug("first_ten"); it(i); i = i + 1; } } // -*- rust -*- fn main() { let mut sum: int = 0; first_ten {|i| #debug("main"); log(debug, i); sum = sum + i; }; #debug("sum"); log(debug, sum); assert (sum == 45); } fn first_ten(it: fn(int)) { let mut i: int = 0; while i < 10 { #debug("first_ten"); it(i); i = i + 1; } } // -*- rust -*- fn main() { let mut sum: int = 0; do first_ten {|i| #debug("main"); log(debug, i); sum = sum + i; } #debug("sum"); log(debug, sum); assert (sum == 45); } fn first_ten(it: fn(int)) { let mut i: int = 0; while i < 10 { #debug("first_ten"); it(i); i = i + 1; } } // -*- rust -*- fn main() { let mut sum: int = 0; do first_ten |i| { #debug("main"); log(debug, i); sum = sum + i; } #debug("sum"); log(debug, sum); assert (sum == 45); } fn first_ten(it: fn(int)) { let mut i: int = 0; while i < 10 { #debug("first_ten"); it(i); i = i + 1; } } // -*- rust -*- fn main() { let mut sum: int = 0; do first_ten |i| { debug!{"main"}; log(debug, i); sum = sum + i; } debug!{"sum"}; log(debug, sum); assert (sum == 45); } fn first_ten(it: fn(int)) { let mut i: int = 0; while i < 10 { debug!{"first_ten"}; it(i); i = i + 1; } } // -*- rust -*- fn main() { let mut sum: int = 0; do first_ten |i| { debug!("main"); log(debug, i); sum = sum + i; } debug!("sum"); log(debug, sum); assert (sum == 45); } fn first_ten(it: fn(int)) { let mut i: int = 0; while i < 10 { debug!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // -*- rust -*- fn main() { let mut sum: int = 0; do first_ten |i| { debug!("main"); log(debug, i); sum = sum + i; } debug!("sum"); log(debug, sum); assert (sum == 45); } fn first_ten(it: fn(int)) { let mut i: int = 0; while i < 10 { debug!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // -*- rust -*- pub fn main() { let mut sum: int = 0; do first_ten |i| { debug!("main"); log(debug, i); sum = sum + i; } debug!("sum"); log(debug, sum); assert (sum == 45); } fn first_ten(it: fn(int)) { let mut i: int = 0; while i < 10 { debug!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // -*- rust -*- pub fn main() { let mut sum: int = 0; do first_ten |i| { debug!("main"); log(debug, i); sum = sum + i; } debug!("sum"); log(debug, sum); fail_unless!((sum == 45)); } fn first_ten(it: fn(int)) { let mut i: int = 0; while i < 10 { debug!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // -*- rust -*- pub fn main() { let mut sum: int = 0; do first_ten |i| { debug!("main"); log(debug, i); sum = sum + i; } debug!("sum"); log(debug, sum); fail_unless!((sum == 45)); } fn first_ten(it: &fn(int)) { let mut i: int = 0; while i < 10 { debug!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // -*- rust -*- pub fn main() { let mut sum: int = 0; do first_ten |i| { debug!("main"); debug!(i); sum = sum + i; } debug!("sum"); debug!(sum); fail_unless!((sum == 45)); } fn first_ten(it: &fn(int)) { let mut i: int = 0; while i < 10 { debug!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // -*- rust -*- pub fn main() { let mut sum: int = 0; do first_ten |i| { debug!("main"); debug!(i); sum = sum + i; } debug!("sum"); debug!(sum); assert!((sum == 45)); } fn first_ten(it: &fn(int)) { let mut i: int = 0; while i < 10 { debug!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // -*- rust -*- pub fn main() { let mut sum: int = 0; do first_ten |i| { debug!("main"); debug!(i); sum = sum + i; } debug!("sum"); debug!(sum); assert_eq!(sum, 45); } fn first_ten(it: &fn(int)) { let mut i: int = 0; while i < 10 { debug!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // -*- rust -*- pub fn main() { let mut sum: int = 0; do first_ten |i| { info!("main"); info!(i); sum = sum + i; } info!("sum"); info!(sum); assert_eq!(sum, 45); } fn first_ten(it: &fn(int)) { let mut i: int = 0; while i < 10 { info!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // -*- rust -*- pub fn main() { let mut sum: int = 0; do first_ten |i| { info2!("main"); info2!("{}", i); sum = sum + i; } info2!("sum"); info2!("{}", sum); assert_eq!(sum, 45); } fn first_ten(it: &fn(int)) { let mut i: int = 0; while i < 10 { info2!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // -*- rust -*- pub fn main() { let mut sum: int = 0; do first_ten |i| { info!("main"); info!("{}", i); sum = sum + i; } info!("sum"); info!("{}", sum); assert_eq!(sum, 45); } fn first_ten(it: &fn(int)) { let mut i: int = 0; while i < 10 { info!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. pub fn main() { let mut sum: int = 0; do first_ten |i| { info!("main"); info!("{}", i); sum = sum + i; } info!("sum"); info!("{}", sum); assert_eq!(sum, 45); } fn first_ten(it: &fn(int)) { let mut i: int = 0; while i < 10 { info!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. pub fn main() { let mut sum: int = 0; do first_ten |i| { info!("main"); info!("{}", i); sum = sum + i; } info!("sum"); info!("{}", sum); assert_eq!(sum, 45); } fn first_ten(it: |int|) { let mut i: int = 0; while i < 10 { info!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. pub fn main() { let mut sum: int = 0; first_ten(|i| { info!("main"); info!("{}", i); sum = sum + i; }); info!("sum"); info!("{}", sum); assert_eq!(sum, 45); } fn first_ten(it: |int|) { let mut i: int = 0; while i < 10 { info!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. pub fn main() { let mut sum: int = 0; first_ten(|i| { println!("main"); println!("{}", i); sum = sum + i; }); println!("sum"); println!("{}", sum); assert_eq!(sum, 45); } fn first_ten(it: |int|) { let mut i: int = 0; while i < 10 { println!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. pub fn main() { let mut sum: int = 0; first_ten(|i| { println!("main"); println!("{}", i); sum = sum + i; }); println!("sum"); println!("{}", sum); assert_eq!(sum, 45); } fn first_ten<F>(mut it: F) where F: FnMut(int) { let mut i: int = 0; while i < 10 { println!("first_ten"); it(i); i = i + 1; } } // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. pub fn main() { let mut sum: isize = 0; first_ten(|i| { println!("main"); println!("{}", i); sum = sum + i; }); println!("sum"); println!("{}", sum); assert_eq!(sum, 45); } fn first_ten<F>(mut it: F) where F: FnMut(isize) { let mut i: isize = 0; while i < 10 { println!("first_ten"); it(i); i = i + 1; } }