4 ms·
Well, Julia also has a pipeline operator built in so: array |> mean |> x->round(x; digits=2) will do what you want and is arguably more readable than dot no
by staplung 2y ago
Well, Julia also has a pipeline operator built in so:
array |> mean |> x->round(x; digits=2)
will do what you want and is arguably more readable than dot notation.
Not supporting OOP is very much intentional. It has structs and multiple dispatch (which has proven to be insanely useful in Julia's domain of scientific computing) so about the only thing you lose is the namespacing that dot syntax facilitates.
- deleted 2y ago[deleted]
- brabel 2y agoThat's not more readable, you're just switching a few characters. Any language that has Uniform Function Call Syntax (UFCS) [1] lets you replace wrapped function calls with linear calls like that, it's clearly easier to read, and much easier to write, specially when you consider programmers' tooling (in case it's not obvious why: you can type the name of a symbol and a '.' and the IDE shows you the available functions... this works also for free functions that take the symbol's type as the first argument as well.... that could work for the pipe operator as well, of course, that's why I said that the two things are basically equivalent, just with slightly different notation). [1] https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax