Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
edited body; edited title
Source Link
false
  • 10.3k
  • 13
  • 111
  • 225

Prolog can somebody exaplainexplain this recursion

Can someone explain how the following prologProlog recursion works ?

findRoute(A,A,_). findRoute(A,C,Path) :- nextCnvZone(A,B), \+ member(B,Path), findRoute(B,C,[B|Path]). 

I can understand the second part but could not understand the first part i.e what is the first findRoute(A,A,_). doing ?

Prolog can somebody exaplain this recursion

Can someone explain how the following prolog recursion works ?

findRoute(A,A,_). findRoute(A,C,Path) :- nextCnvZone(A,B), \+ member(B,Path), findRoute(B,C,[B|Path]). 

I can understand the second part but could not understand the first part i.e what is the first findRoute(A,A,_). doing ?

Prolog can somebody explain this recursion

Can someone explain how the following Prolog recursion works ?

findRoute(A,A,_). findRoute(A,C,Path) :- nextCnvZone(A,B), \+ member(B,Path), findRoute(B,C,[B|Path]). 

I can understand the second part but could not understand the first part i.e what is the first findRoute(A,A,_). doing ?

edited tags
Link
false
  • 10.3k
  • 13
  • 111
  • 225
Source Link
theadnangondal
  • 1.7k
  • 3
  • 15
  • 32

Prolog can somebody exaplain this recursion

Can someone explain how the following prolog recursion works ?

findRoute(A,A,_). findRoute(A,C,Path) :- nextCnvZone(A,B), \+ member(B,Path), findRoute(B,C,[B|Path]). 

I can understand the second part but could not understand the first part i.e what is the first findRoute(A,A,_). doing ?