3 ms·
In Julia, this would be: 1:3 |> x->x+1 |> x->join(x,",") |> length
by msravi 8y ago
In Julia, this would be:
1:3 |> x->x+1 |> x->join(x,",") |> length
- duckerude 8y agoSmall correction (or it won't run on my system): 1:3 |> x -> map(y -> y+1, x) |> x -> join(x, ",") |> length All those anonymous functions seem a bit distracting, though https://github.com/JuliaLang/julia/pull/24990 https://github.com/JuliaLang/julia/pull/24990 could help with that.
- msravi 8y agoOk... not sure which version of Julia you're using, but I'm on 0.5 and it works there... Maybe it changed in a later version
- shele 8y agoMaybe a bit nicer (1:3 .|> x->x+1) |> x->join(x,",") |> length
- msravi 8y agoOk, in Julia 1.0+ you just have to use the dot operator: 1:3 |> x->x.+1 |> x->join(x,",") |> length Note the dot in x.+1, that tells + to operate on each element of the array (x), and not the array itself.