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.

  • 1
    $\begingroup$ 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. $\endgroup$ – Karolis Juodelė May 18 '14 at 7:03
  • $\begingroup$ 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. $\endgroup$ – dokkat May 18 '14 at 8:45
  • $\begingroup$ It does seem that partially reappplying seems easier to do than unapplying, as not all functions are inversible. $\endgroup$ – NightRa May 18 '14 at 9:41
  • $\begingroup$ 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). $\endgroup$ – vzn Jun 1 '14 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.