For Programmers: Free Programming Magazines  


Home > Archive > Prolog > April 2005 > Losing values on Recursive Exit









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Losing values on Recursive Exit
xanthu*

2005-04-27, 10:59 pm

Hi,

I am running a pathing routine and summing the Cost:

path(Start,Finish,C2) :-
next(Start,Next,Finish,Cost),
C1 is C2 + Cost,
path(Next,Finish,C1).

Once I hit the base case:
path(Finish,Finish,Cost).

I exit out of the recursion stack. Debug reports my C1 variable is regressing backwards 10, 7, 3, Unbound.

How do I save the value off the recursion stack?

Please help.

Thanks,
xanthu
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com