Ticket #23 (closed defect: fixed)
Differents results when debug is enabled ...
| Reported by: | victor | Owned by: | pmoura |
|---|---|---|---|
| Priority: | major | Milestone: | Logtalk distribution |
| Component: | compiler | Version: | 2.32.1 |
| Keywords: | Cc: |
Description
Hello,
I found this strange bug, using this predicate :
:- object(test2).
:- public(union/3).
mymemberchk(E, T) :-
varlist::memberchk(E, T), !.
mymemberchk(E, T) :-
list::member(E, T).
union([], L, L).
union([H|T], L, R) :-
( mymemberchk(H, L) *->
union(T, L, R)
; union(T, L, R2),
R = [H|R2]
).
:- end_object.
?- set_logtalk_flag(debug, on). true. ?- logtalk_load(test2). % test2.pl compiled 0.00 sec, 4,252 bytes true. ?- test2::union([a], [a], R). R = [a] ; R = [a, a]. ?- set_logtalk_flag(debug, off). true. ?- logtalk_load(test2). % test2.pl compiled 0.00 sec, -812 bytes true. ?- test2::union([a], [a], R). R = [a].
As you can see, when debug is on, union/3 backtracks in a strange way.
I tried to look at the trace, but I am not sure to understand what is happening :>
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
