Suppose I have a function like this:
func compute(_ f: (Double, Double) -> Double,_ lhs: Double,_ rhs: Double) -> Double {
return f(lhs, rhs)
}
let result = compute(+,2,2)
print(result)
That compiles and it works as expected. It prints out 4
But then, if I delete that function 'compute' and just type this:
let result = +(2,2)
Why doesn't this work?
I mean, isn't that what basically is happening inside the 'compute' function?
Thanks.