Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!ukc!mucs!liv-cs!dave8 From: dave8@and.cs.liv.ac.uk Newsgroups: comp.lang.prolog Subject: Prolog parser bug in reading conditional? Or not? Message-ID: <1991Feb22.172635.16587@and.cs.liv.ac.uk> Date: 22 Feb 91 17:26:35 GMT Organization: Computer Science, Liverpool University Lines: 26 Re. the conditional, ->/2. Is the following a bug or a feature? If the following is entered during a consult/1 ... a( X ) :- ( true -> X = 1 ) ; X = 2 . then, when it is listed, it appears as a( X ) :- ( true -> X = 1 ; X = 2 ) . or a( X ) :- true -> X = 1 ; X = 2 . depending on which Prolog you run ... and, when it is executed, you only get a single solution: X = 1. I would have thought that this was a bug, but is it? It occurs with both C-Prolog 1.5a and POPLOG Prolog version 11. However, if you enter (the workaround) (I did want to use code like the above but obviously replacing "true" with some predicate) ... b( X ) :- ( true -> X = 1 ; fail ) ; X = 2 . then, when it is listed, it appears as the above, or the above plus a pair of extra brackets around the body ... and, when it is executed, both solutions are given (on backtracking) ( X = 1, then, X = 2 ) (as expected). Is this a parser problem or not? If so, it is a problem with a number of existing parsers. Dave Sherratt. Now probably ads@uk.ac.liv.cs