Hello,
The code below (test_sub_atom/1), shows some issue when backtracking on
sub_atom/5 internal predicate.
Result is :
| ?- test_sub_atom(R).
R = ['AAAACCRR']
Where I would have expected :
R = ['AAAACCRR','BBBBCCRR']
While performing a trace, it looks that the issue is the 3rd (and 4th)
parameter of sub_atom/5 remain bound after backtracking, preventing to test
different sizes of atoms.
The code test_sub_atom_bis/1 does not show the same kind of issue (and
solves my problem for now !).
| ?- test_sub_atom_bis(R).
R = ['AAAACCRR','BBBBCCRR']
I am running GNU Prolog 1.3.0, compiled with GCC 4.0, on Mac OS X 10.4.9.
Best regards,
Alain Strebelle
Capacity Planning
SWIFT
Avenue Adele, 1, B-1310, La Hulpe
Belgium
Tel: +32 2 655 36 43
eMail: [EMAIL PROTECTED]
/***********************/
/*** test_sub_atom/1 ***/
/***********************/
test_sub_atom(DEST_LIST) :-
findall(
DEST,
(
member(DEST,['AAAACCRR','BBBBCCRR','CCCCCCRR']),
once(
(
member(URDEST,['AAAACCRR0','BBBB']),
(
sub_atom(DEST,0,_,_,URDEST);
sub_atom(URDEST,0,_,_,DEST)
)
)
)
),
DEST_LIST
), !.
/***************************/
/*** test_sub_atom_bis/1 ***/
/***************************/
test_sub_atom_bis(DEST_LIST) :-
findall(
DEST,
(
member(DEST,['AAAACCRR','BBBBCCRR','CCCCCCRR']),
once(
(
member(URDEST,['AAAACCRR0','BBBB']),
(
atom_concat(URDEST,_,DEST);
atom_concat(DEST,_,URDEST)
)
)
)
),
DEST_LIST
), !.
_______________________________________________
Bug-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-prolog