Hello,
Apologies for this rather elementary question. I'm learning prolog via Michael Covington's Prolog Programming in Depth and working through the examples using Ciao 1.14.2.
(The book, and source files can be found at: http://www.covingtoninnovations.com/books.html).
I'm having difficulty getting the car.pl example to work (pg 54-60). He uses the following to parse a single character input (Y or N):
get_yes_or_no(Result) :- get(Char), % read a character.
get0(_), % consume the Return after it. interpret(Char,Result),
!. % cut -- see text
Apparently, Ciao has neither a a get/1 nor a get0/1 predicate. As far as I can tell, the original get0/1 predicate parses a return character, unifies it with an anonymous variable (resulting in yes), and then procedes to the predicate interpret().
I changed get(Char) to get_char(Char), and get0 to get_code(_), but this puts me in an endless loop that calls get_yes_or_no again. get_char(_) is similarly incorrect. Is there a predicate that is exactly equivalent to get0(_), or is there a more complex solution involving streams?
Thanks in advance.