-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce better piping syntax #38090
Comments
See the end of #5571 (in case you haven't already) for some discussion of this. I think this specific proposal is unworkable since |
Thanks for taking a look either way! |
.. would be interesting as another operator like .. from Dart, I suggest mutable struct S
number::Int
end
S §(
number = 7;
print(_ <: Number);
) |
In case you haven't seen it yet, I wrote https://github.com/jkrumbiegel/Chain.jl for that reason (I know the struggles of German keyboards..) |
That looks very nice |
Hello,
This is inspired by R's dplyr lib (and sort of by Pipe.jl)
Proposal TLDR
Introduce
..
as an operator such thatx..f(y)
is equivalent tof(x,y)
in order to improve readability, and writing productivity.
Problem
Consider the scenario where you would like to perform a 3 operations on a dataframe: dropmissing, innerjoin, and then select. The current pipe operator is hard to type on a German keyboard which makes it prohibitive to use.
In scala we would get code that is very succinct and readable like this
In Julia we would we have a few options, neither of which are particularly promising
Option 1
This is not ideal because the order or execution does not match the order of code-reading
Option 2
This is not succinct, and the redundant code increases time-to-read/time-to-understand. One also sacrifices immutability here. One could come up with new variable names for each assignment to maintain immutability but that doesn't feel like the best idea either.
Option 3
Use
@pipe
from Pipe.jl, but it is very annoying to write |> on a German keyboard, and the need to add@pipe
everywhere destroys readability and succinctness (at no fault of the author to Pipe.jl, I appreciate that package very much)Solution with proposed syntax
This is succinct, backwards compatible, way more readable (faster time-to-understand), and much easier to code on a German (or any other) keyboard.
Reasons why
..
|>
struct.function()
syntax()
redundant for functions with just one argument. E.g.df..dropmissing
can be equivalent todf..dropmissing()
The text was updated successfully, but these errors were encountered: