I have a program that returns int*int
(Example for illustration purposes): fun program(a,b) = (1,2)
I want to do something along the lines:
fun program(a,b)
if a = 0 then (1,2)
else
val x,y = program(a-1,b)
return (x-1, y)
Basically, I want to manipulate the tuple that is returned, and then return a modification of it.
Thanks
This works almost exactly as you wrote it, except that your syntax is a bit off:
fun program(a,b) =
if a = 0 then (1,2)
else
let val (x,y) = program(a-1,b) in
(x-1, y)
end
Specifically:
fun f args = body
- you left out the =
.let val foo = bar in baz end
.