syntax array_initialization from "<" Arg(, type) ">[" [{Arg(, elems) "," [s]} Arg(, elems)] "]" { let res = arr<$type>(); @elems.i { res.push($elems.i); } return move(res); } syntax list_comprehension from "[" [s] Arg(, map) s "for" s Arg(, it) [s] ":" [s] Arg(, type) s "in" s Arg(, container) [s] "]" { let res = arr<$type>(); let func = ($it: $type) -> $type $map; for _it_ in $container { res.push(func(*_it_)); \} return move(res); } let array = [i * 2 for i: Int in [1, 2, 3, 4, 5]]; if array[0] != 2 { panic("Invalid value"); } if array[1] != 4 { panic("Invalid value"); } if array[2] != 6 { panic("Invalid value"); } if array[3] != 8 { panic("Invalid value"); } if array[4] != 10 { panic("Invalid value"); }