4 ms·
The author is confused, their Prolog implementation is clearly a left fold! I'm only half joking :) To elaborate: The variable names "ACC" and "RES" suggest t
by hddqsb 4y ago
The author is confused, their Prolog implementation is clearly a left fold!
I'm only half joking :)
To elaborate: The variable names "ACC" and "RES" suggest the predicate should be viewed as a left fold, because when the predicate is viewed as a right fold the meanings of the variables are flipped.
- gopiandcode 4y agoYes, good catch! I actually wrote the fold predicate thinking of fold left, hence the naming, but as the same predicate can simulate both fold left and right, for the purposes of the blog post, I figured I could get away without renaming the variables.