
Hi - I am trying to work out how the following function using "fix" is evaluated. I am hoping someone could look at my step-by-step breakdown of how I think evaluation works and see if I'm correct. My main question is how the order of operation (fixity?) is understood in going from step [3] to [4], if this is indeed how the evaluation would take place. Any help is appreciated, -andrew Here's the Haskell function: --- fix f = f (fix f) wierdFunc2 x y z = if y - z > z then x (y-z) z else y - z myRemainder = fix wierdFunc2 --- Here's my "evaluation": myRemainder 12 5 -- [1] = fix wierdFunc2 12 5 -- [2] by substitution = wierdFunc2 fix wierdFunc2 12 5 -- [3] apply "fix" = wierdFunc2 myRemainder 12 5 -- [4] by substitution (?) = myRemainder 7 5 -- [5] apply "wierdFunc2" = fix wierdFunc2 7 5 -- [6] by substitution = wierdFunc2 fix wierdFunc2 7 5 -- [7] apply "fix" = wierdFunc2 myRemainder 7 5 -- [8] by substitution (?) = 2 -- [9] apply "wierdFunc2"
participants (1)
-
Harris, Andrew