Skip to content

Instantly share code, notes, and snippets.

@ThatsJustCheesy
Created July 1, 2022 04:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThatsJustCheesy/754aacf7c33a94b997b709487efa96d1 to your computer and use it in GitHub Desktop.
Save ThatsJustCheesy/754aacf7c33a94b997b709487efa96d1 to your computer and use it in GitHub Desktop.
Crystal Proc#curry method (implemented with macros)
struct Proc(*T, R)
def curry
{% begin %}
{% for i in 0...T.size %}
->(arg_{{i}} : {{T[i]}}) {
{% end %}
self.call(
{% for i in 0...T.size %}
arg_{{i}},
{% end %}
)
{% for i in 0...T.size %}
}
{% end %}
{% end %}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment