It takes ADT, but not function currying, and so on.
I think that's a good thing. A curried function is a function that takes one argument, and returns a closure that captures the argument. That closure might itself take another argument, and return a new closure that captures both the original argument and the second one. And so on ad infinitum. How ownership and borrowing works across that chain of closures could easily become a touchy issue, so you probably want to be making it as explicit as possible.
Or perhaps better yet, find an easier way to accomplish the same task. Maybe use a struct to explicitly carry the arguments along until you're ready to call the function.
I'd love to have a syntax like
{ foo(%1, bar) }
standing for |x| { foo(x, bar) }
though. I'm not aware of any language that has this! &foo(&1, bar) user=> (#(println %1 %2) "Hello " "Clojure")
Hello Clojure In[1]: Map((1 + #1)&, {a, b, c})
Out[1]: {a + 1, b + 1, c + 1}
See https://reference.wolfram.com/language/ref/Function.html.en for the full story.https://reference.wolfram.com/language/tutorial/FunctionalOp...
> for_each(a.begin(), a.end(), std::cout << _1 << ' ');
Also, Scala has something similar as a first class feature[2].
[1]: https://www.boost.org/doc/libs/1_88_0/doc/html/lambda.html
[2]: https://scala-lang.org/files/archive/spec/3.4/06-expressions...
{ foo[x, bar] } { foo($0, bar) } foo(%1, bar(%1, 42))
does this desugar to: |x| foo(x, |y| bar(y, 42))
or to: |x| foo(x, bar(x, 42))
and do you trust the person reading this code later to remember which one it is?I'm relatively sure there exists such a language you are looking for, but I've forgotten its name :(.
There was a syntax extension pa_holes for OCaml (which you perhaps know, as it is natively currying) that worked like
(\ foo \1 bar)
and it would become fun x -> foo x bar
I'm sure the extension was inspired by some other language.. And the pa syntax extension extension mechanism for OCaml has been replaced by ppx a long time ago already; maybe the new system doesn't enable such succinct extensions.