:PROPERTIES:
:ID: 78ba09b2-e6c6-4357-83dc-40a909957aa9
:mtime: 20231023034803 20231023021751
:ctime: 20231023021715
:END:
#+title: curried function
#+filetags: :project:public:
* Definition of currying
In the context of functional programming, *currying* refers
to transforming a function of multiple arguments into a function of
1 argument.
** In Haskell
In haskell, you would write this as
#+BEGIN_SRC haskell
curry :: ((a , b) -> c) -> a -> b -> c
curry f x y = f (x , y)
#+END_SRC
** In [[id:8952459c-5076-4e68-8a68-5f658209f39e][Ocaml]]
In [[id:8952459c-5076-4e68-8a68-5f658209f39e][Ocaml]], you would write this as
#+BEGIN_SRC ocaml
let curry f x y = f (x , y)
#+END_SRC
#+RESULTS:
: <fun>
* Etymology
Currying is named after the logician Haskell Brook Curry.