I'm experimenting with this in SML
- val p = (fn (x,y) => x + y, fn (x,y) => x - y)
val p = (fn,fn) : (int * int -> int) * (int * int -> int)
But I may only evaluate it one at a time
- #1(p)(3,2)
5
or
- #2(p)(3,2)
1
Why can I not do both?
- (p)(3,2)
Error: operator is not a function [tycon mismatch]...
What quasi-lambda calculus form would I need to have it return a 2-tuple, the first position from x+y
lambda function, and the second from x-y
lambda function? At first glance, that's what it looks like it will do. In general, I'm lost as to what a variable and a function is in this example.