0
是否有可能使用|>
与多个参数?prelude.ls |>与多个参数
sum = (a, b)->
a + b
10, 12 |> sum # "Unexpected ','"
sum(10,12) # this is fine
10 |> sum 12, _ # this works, but is there a better way?
是否有可能使用|>
与多个参数?prelude.ls |>与多个参数
sum = (a, b)->
a + b
10, 12 |> sum # "Unexpected ','"
sum(10,12) # this is fine
10 |> sum 12, _ # this works, but is there a better way?
您不能在一个以上的参数中输入|>
。
10 |> sum 12
可以正常工作。
PS。你可以写sum = (+)
谢谢! @gkz,你能显示'sum =(+)'后面的下一步吗? – muyueh
没有下一步,我只是告诉你,你可以用'(+)'代替'sum'。 – gkz