3 ms·
Of course, the definition we actually use is this: -- (1) fix f = let x = f x in x Because it has better memory usage; the definition you provided is
by evincarofautumn 8y ago
Of course, the definition we actually use is this:
-- (1)
fix f = let x = f x in x
Because it has better memory usage; the definition you provided is translated to the following STG:
-- (2)
fix f = let x = fix f in f x
So whereas #1 is a thunk that refers to itself, #2 is a recursive function, and importantly not tail-recursive.