Skip to content

Instantly share code, notes, and snippets.

@duane
Created December 14, 2011 01:55
Show Gist options
  • Save duane/1474880 to your computer and use it in GitHub Desktop.
Save duane/1474880 to your computer and use it in GitHub Desktop.
mutability not working?
use std;
fn poke(value: uint, index: uint, data: @mutable [mutable uint]) {
(*data)[index] = value;
}
fn main(_args: [str]) {
let vec = [mutable 4u];
std::io::println(#fmt["%u", vec[0]]);
poke(3u, 0u, @mutable vec);
std::io::println(#fmt["%u", vec[0]]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment