recursion - Why won't this Prolog predicate unify? -
I write a bill to find all the potential successor states for the repetition of A * and [(cost, State), ...], which stands at this time:
addSuccessors (L, [], _). AddSuccessors (L, [x | T], oristist): - Add (Orgistist, Index, X), ((X, Index), L, List 2), Add Softers (List 2, T, Oristist). AddSuccessors (L, [x | []], Origin: - Add (Genesis, Index, X) (X, Index), L, L2), Add Softers (L2, [], Oristist).
Adds something to the end of a list, Memambi receives the th element of a list (index) I know that they work, and when I down to L2 Undoubtedly, I find something like this.
- addSuccessors (X, [1500, 3670], [0, 0, 0, 1500, 3670]) x = []; [(1500, 3), (3670, 4)] x = []; X = [_G1175]; [_G1175, (1500, 3), (3670, 4)] x = [_G1175]; X = [_G1175, _G1181]; [_G1175, _G1181, (1500, 3), (3670, 4)] x = [_G1175, _G1181]; ...
Which is very disappointing because [[(1500, 3), (3670, 4)] is what I want to do after calling X, so it looks
"text">
I am briefly after programmed in the program Well, but I think that you need to separate the list that you are creating from the list that you come back (i.e., add another parameter). [X | Your rule for []] should bind the output variable and not be a screwdriver.
Comments
Post a Comment