Stefan: Yes that's obviously valid. Simon's "foreach" is essentially what
I mean.
Although overriding the pipe operator would probably break things, I think
ideally there would be a built-in solution that looks similar to this:
julia> |>(A::AbstractArray, f::Function) = (for x in A; f(x); end; A)
|> (generic function with 7 methods)
julia> type MyType; x::Int; end
julia> add_one!(mt::MyType) = mt.x += 1
add_one! (generic function with 1 method)
julia> A = map(MyType, 1:2)
2-element Array{MyType,1}:
MyType(1)
MyType(2)
julia> A |> add_one! |> add_one!
2-element Array{MyType,1}:
MyType(3)
MyType(4)