These examples compile on rustc 0.11-pre-nightly (540c2a2 2014-04-04 01:01:51 -0700)
// vector testing
// Vector is kind of complicated part of Rust, partly because it's also convolved with pointers ~, &.
// As of Apr 2014, you can assume Vec<T> is a first choice for dynamic (size-changing) arrays.
// https://mail.mozilla.org/pipermail/rust-dev/2014-April/009352.html
use std::vec;
fn main() {
let vs: Vec<int> = range(0,10).map(|i| i * 10).collect();
println!("{}",vs);
println!("{}",mk_array());
}
// You don't need to use reference for returning Vec<T>.
// Vec<T> is a small struct with a pointer, so copying is low cost.
fn mk_array() -> Vec<uint> {
range(0u,10).map(|i| i + 2).collect()
}