我正试图在Reason中做这样的事情:
let {map, fold_left} = List;
let {log} = Js;
let list = [1,2,3];
list |> map(i => i + 1) |> fold_left((p,c) => p+c, 0) |> log;
基本上,我只想从模块中导入几个函数。这在理性中是否可行。
目前我这样做:
let map = List.map;
let fold_left = List.fold_left;
let log = Js.log;
答案 0 :(得分:4)
来自Discord,由@octachron提供
let (map,fold_left) = List.(map, fold_left)