bug-prolog
[Top][All Lists]
Advanced

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

GNU Prolog issue with backtracking on sub_atom/5


From: STREBELLE Alain
Subject: GNU Prolog issue with backtracking on sub_atom/5
Date: Mon, 30 Apr 2007 13:47:08 -0000
User-agent: Microsoft-Entourage/11.3.3.061214

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: address@hidden


/***********************/
/*** 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
    ), !.






reply via email to

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