map 在管道怎么使用?

[1,2,3] |> map(print)
#ERROR: MethodError: objects of type Nothing are not callable
#Stacktrace:
# [1] |>(x::Vector{Int64}, f::Nothing)
#   @ Base .\operators.jl:966
# [2] top-level scope
#   @ REPL[25]:1

readdir(".") |> map(x -> joinpath(abspath("."), x))
# ERROR: MethodError: no method matching (::var"#9#10")()
# Closest candidates are:
#  (::var"#9#10")(::Any) at REPL[23]:1
# Stacktrace:
# [1] map(f::var"#9#10")
#  @ Base .\abstractarray.jl:2947
# [2] top-level scope
#   @ REPL[23]:1

  [1,2,3] |> map(x -> x+2)
# ERROR: MethodError: no method matching (::var"#11#12")()
# Closest candidates are:
#  (::var"#11#12")(::Any) at REPL[24]:1
# Stacktrace:
# [1] map(f::var"#11#12")
#   @ Base .\abstractarray.jl:2947
# [2] top-level scope
#   @ REPL[24]:1

map 在管道怎么正确使用 :persevere:

[1,2,3] |>t-> map(x -> x+2,t)

或者

[1,2,3] |> @. x -> x+2

这个 @. 是什么意思

向量化的宏,把后边的运算向量化。比如

@. f(g(h))

计算结果和 f.(g.(h)) 一致

有一种替代map的写法:[1, 2, 3] .|> print