BT编程语言文档
flat_map
首先使用映射函数映射每个元素,然后将结果压平语法 Array.flat_map(callback:Fn(value:Any, key:Int, current:Any))
arr = [1, 2, 3] println arr.flat_map(fn(v){ v * 2 }) // 输出:[1, 2, 2, 4, 3, 6]语法 Array.flat_map(callback:Fn(value:Any, key:Int, current:Any))
arr = [1, 2, 3] println arr.flat_map(fn(v){ v * 2 }) // 输出:[1, 2, 2, 4, 3, 6]