3 ms·
It is left as an exercise to the reader to implement this algorithm efficiently, but I really like the elegant use of recursion. For those who can't be bothere
by userbinator 7y ago
It is left as an exercise to the reader to implement this algorithm efficiently, but I really like the elegant use of recursion.
For those who can't be bothered diffing, the fix in the corrected version is inside the 3rd condition of subst().