users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

too simple trace


From: Gilles Dégottex
Subject: too simple trace
Date: Tue, 29 Apr 2003 11:21:36 +0200
User-agent: KMail/1.5.1

Hi all

        I think gprolog does a too much simple trace on this exemple:

permutation([], []).
permutation(List, [S|Perm]) :-
        select(S, List, Rest),
        permutation(Rest, Perm).

select(Element, [Element|Tail], Tail).
select(Element, [Head|Tail1], [Head|Tail2]) :-
        select(Element, Tail1, Tail2).

=>
"
Prolog interruption (h for help) ? t
The debugger will first creep -- showing everything (trace)
| ?- permutation([1, 2, 3], L).
      1    1  Call: permutation([1,2,3],_23) ?
      1    1  Exit: permutation([1,2,3],[1,2,3]) ?

L = [1,2,3] ?

yes
{trace}
| ?-
"

no call to select, and no different trace if I press "shift+;" for the other 
solutions. maybe I missed an option

I thought it was a nice exemple for studients, to show the backtraking engine, 
since they saw these two lines :)

Tanks for comments
Gilles





reply via email to

[Prev in Thread] Current Thread [Next in Thread]