# Is there any programming system that enables reversible computations?

Better explained with examples, I need a programming system with the following characteristics:

f = λ a b c -> a + b + c
g = apply f 1 2 3 = 6
h = unapply g _ 2 _ = λ b -> 4 + b


Or, to explain with words, f is a function, g is that function applied to 3 arguments, and h is g "unapplied" to one argument. That is, I need a programming system where you can define functions and apply them to arguments, like the Lambda Calculus. But I also need this system to have an unapply operator, with which you can recover a partially applied function from the value of its argument.

• What is unapply g _ 3 _ ? Anyway, since g is clearly not a numeric type, it might as well be a tuple of f and 1, 2, 3. – Karolis Juodelė May 18 '14 at 7:03
• Nothing, maybe unapply g _ * _ would be better. I just wanted to empathise the information preservation. Also, yes, but that approach means you have to re-apply "g" to the other arguments. I was thinking some system more natural / two-ways could exist. – dokkat May 18 '14 at 8:45
• It does seem that partially reappplying seems easier to do than unapplying, as not all functions are inversible. – NightRa May 18 '14 at 9:41
• why do you need this? a general principle that commands propagate their arguments forward as well as their computation works for reversibility. in qm computing this is called ancilla bits. another option is reversible logic gates. also note the functions/data cannot be mutable (store state). – vzn Jun 1 '14 at 3:45