Are there any functions that are computable but not curriable?

88 Views Asked by At

Sorry if I'm a bit lost. I've recently started learning about different programming language paradigms and I found that all texts presuppose that all functions written in a programming language are curriable. I haven't seen any proof of this and after looking for a while I found information about cartesian closed categories. My knowledge of mathematics is quite limited so I don't know if this is applied to, well, everything that can be done with a turing machine. My guess is that something like this is proven (or maybe it's obvious and my knowledge is too limited). Thank you in advance.

I tried to find some answers in Google but I'm out of luck.

2

There are 2 best solutions below

4
Bartosz Milewski On

It's difficult to answer this question without a context. Currying means that a function that takes a pair of argumenst is equivalent to a function of one argument that returns a function of the second argument. So, obviously, in programming languages in which functions are not first-class citizens, currying makes no sense, since you can't return a function. In functional languages, on the other hand, currying is built in from the get go. In lambda calculus where everything is a function, the pair itself is defined as a function returning a function.

0
michid On

There is an isomorphism between curried and uncurried functions. For example in Haskell via

curry :: ((a, b) -> c) -> a -> b -> c
curry f x y =  f (x, y)

uncurry :: (a -> b -> c) -> ((a, b) -> c)
uncurry f p =  f (fst p) (snd p)

such that

curry . uncurry = uncurry . curry = id

All properties of a function carry over via this isomorphism. In particular, if function f is (non)computable so is curry f and vice versa.

Note, whether a particular programming language is able to express the idea of currying is a different question. For example in pure lambda calculus there are only curried functions and no syntax for uncurried ones. Languages without support for higher order functions (e.g. the C language) make it hard (if not impossible) to write curried functions.