-
-
Notifications
You must be signed in to change notification settings - Fork 25
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 operator support #72
Comments
The easiest way to make it work right now I think, would be to make the partial function application compile to anonymous functions first (tracked in #44) and then introduce a pipe function in |
I agree that I'd expect this to behave like in OCaml. I also think that I should bring up that ReScript and Reason chose to favor "pipe first" ( I haven't really experienced any problems with |
@Ostera I would love to implement this! |
@ayshiff dope! 🚀 the easiest would be to expose But feel free to give it an initial stab by just hacking around the compiler, and we can then refine it 🙌🏽 |
It would be great to have support for the pipe operator. It is a common way in many functional programming languages to compose functions into a readable left-to-right or top-to-bottom "pipeline" of steps of computation.
Documentation in OCaml stdlib
Documentation in Elixir Kernel
I think it should probably behave like in OCaml and not like Elixir, meaning this Caramel code in file
main.ml
when ran withocaml compile main.ml && escript main.erl
would print2
(notice the order of arguments insubtract
anddivide
):so it would be equivalent to this Caramel code:
and behave the same as this toplevel OCaml code:
when executed:
The text was updated successfully, but these errors were encountered: