3 ms·
Why do you need route? Can't you just use the roads you've got as the base case and then say road(X, Z) :- road(X,Y), road(Y,Z)
by bear8642 5y ago
Why do you need route?
Can't you just use the roads you've got as the base case and then say
road(X, Z) :- road(X,Y), road(Y,Z)
- spinningslate 5y ago> Why do you need route? Because it creates a left-recursive call that will eventually cause a stack overflow. If you want to try it out, there's Swish[0] - an online prolog editor and interpreter. [0]: https://swish.swi-prolog.org/ https://swish.swi-prolog.org/