Broadcasting and piping

The basic pipe operator allows for broacasting e.g. 1:5 .|> exp

As far as I know @chain and Lazy @> don’t support this.
You can get around this by defining. ⬅map(a,b) = map(b,a)
and writing

@> 1:5  ⬅map(exp)


@chain 1:5  begin

Is there a briefer way to do this? maybe through a macro or something?
be great if you could just writ.

@> 1:5  exp.

@chain 1:5 begin

With DataPipes:

using DataPipes

@p 1:5 |> map(exp)
# and even further:
@p 1:5 |> map(exp(_) + 1)
1 Like

With Chain this works:

@chain 1:5 exp.()

Chain also has @. exp although I sometimes wondered if it was good to add it :wink:

You can’t really go shorter than @. exp or exp.() because exp. and all variants of it are not valid syntax. At least to my knowledge there’s no way to go shorter here, that’s one slight advantage of .|>.


Thanks everyone.
Some really useful tips