Comment

Comment by evincarofautumn

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.

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton