我阅读了https://github.com/JuliaLang/julia/issues/5571,这让我觉得由于一些评论我可以打破这样的界限:
a = [x*5 for x in 0:20 if x>4]
scale(y) = (x)-> y*x
filter(y) = x -> [z for z in x if z>y]
a|>(x->x/3)
|>scale(2)
|>filter(4)
|>println
Run Code Online (Sandbox Code Playgroud)
但我得到错误:
ERROR: LoadError: syntax: "|>" is not a unary operator
in include_from_node1(::String) at ./loading.jl:488
in process_options(::Base.JLOptions) at ./client.jl:265
in _start() at ./client.jl:321
Run Code Online (Sandbox Code Playgroud)
我被迫使用a|>(x->x/3)|>scale(2)|>filter(4)|>println?
julia ×1