When you are in a do block, in order to emulate a "while loop" it's common to see people declaring a "loop" function in a let statement. however, there is this clever function "fix" which allows you to declare and use the function at the same time
main = do
let fac n r = if n == 1 then r else fact (n-1) (n*r)
print $ fact 4 1 -- 24
print $ fix (\rec n r -> if n == 1 then r else rec (n-1) (n*r)) 4 1
the question is, does fix have any advantage over using a let statement? is slower or uses more memory?