Path: utzoo!attcan!uunet!mcsun!sunic!sics.se!sics.se!matsc From: matsc@sics.se (Mats Carlsson) Newsgroups: comp.lang.prolog Subject: DCG expansion pitfall Message-ID: Date: 5 Sep 89 07:22:48 GMT Sender: news@sics.se Distribution: comp Organization: Swedish Institute of Computer Science, Kista Lines: 22 Implementors and users, check how your favourite Prolog expands the DCG clause: p(X) --> ( {test(X)} -> [] ; [token(X)] ). It should expand to something equivalent to p(A, B, C) :- ( test(A) -> B = C ; B = [token(A)|C] ). This is yet another example of the unfortunate fact that (P;Q) is not equivalent to ((true,P);Q) if P = (If->Then). -- Mats Carlsson SICS, PO Box 1263, S-164 28 KISTA, Sweden Internet: matsc@sics.se Tel: +46 8 7521543 Ttx: 812 61 54 SICS S Fax: +46 8 7517230