2011-07-18 10:41:35 -05:00
|
|
|
fn double[T](a: &T) -> [T] { ret ~[a] + ~[a]; }
|
2011-07-08 13:29:29 -05:00
|
|
|
|
2011-07-18 10:41:35 -05:00
|
|
|
fn double_int(a: int) -> [int] { ret ~[a] + ~[a]; }
|
2011-07-08 13:29:29 -05:00
|
|
|
|
|
|
|
fn main() {
|
2011-07-27 07:19:39 -05:00
|
|
|
let d = double(1);
|
2011-07-08 13:29:29 -05:00
|
|
|
assert (d.(0) == 1);
|
|
|
|
assert (d.(1) == 1);
|
|
|
|
|
|
|
|
d = double_int(1);
|
|
|
|
assert (d.(0) == 1);
|
|
|
|
assert (d.(1) == 1);
|
|
|
|
}
|
|
|
|
|