-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Pipe operation to function left-to-right #129
Comments
Hm that is independent of the Pipe operator. I think what you are looking for is changing the behavior of currying in MAGES. Currying states that f(x,y,z) = f(x)(y)(z), such that g(z)=f(x, y). (See: https://github.com/FlorianRappl/Mages/blob/devel/doc/language.md#auto-currying) What we could think about is to introduce a syntax such as
Such a language extension could be useful on other locations, too. What are your thoughts? |
This would be a nice option, however the built-in functions still work in the same way.
Than probably the order of those functions need to be swapped. |
Yeah we don't want to change the currying and for technical reasons you cannot go from left-sided to right-sided (as a matter of fact for most / some functions we don't know "when" the upper bound of arguments ends, i.e., if you have f(x, y, z) but f already returns something useful for f(x, y) then you cannot eat arguments from the right). So the only reliable way is from the left. I actually think that the
quite elegantly imho. |
Pushed an implementation of the placeholder parameter - available in the preview version. |
You are right, this is indeed a very elegant solution that also makes the piping more flexible. |
Currently this is the result of the pipe operator:
Would it be possible to optionally change this behaviour in the library settings so that the left statement is injected into the first parameter of a function?
The text was updated successfully, but these errors were encountered: