3 ms·
> above(X,Y) :- above(X,Z), on(Z,Y). This line alone tells me I'm going to have infinite recursion. That would be a problem in any language, of course, and isn
by zephyrfalcon 8y ago
> above(X,Y) :- above(X,Z), on(Z,Y).
This line alone tells me I'm going to have infinite recursion. That would be a problem in any language, of course, and isn't particularly hard to spot here.
- posterboy 8y agoYeah but no, there are many languages where recursion is not the default solution and recursive versus iterative loops is indeed an often mentioned weirdness, for lack of a better word, at least for beginners, which is the perspective I can speak to. That counts for functional programming, too, where the exact same syntax is used -- so it seems to have its appeal. Also, I want to note, although you didn't say otherwise, that the recursion may be hidden behind layers of indirection. The GP writes as if proper testing and code review was unheared of so the issue would be the same in any language, in principle (safe for testing facilities, which weren't the point however).