[Top][All Lists]

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

Re: How to read a line of text?

From: Ron Stodden
Subject: Re: How to read a line of text?
Date: Fri, 09 Jan 2004 03:59:51 +1100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031015

Re 4 below, I have just discovered the neat (swi-prolog) ability to specify a literal character code in the form 0\'z. This makes things a lot easier! Except in editing, where kwrite under Prolog highlighting wrongly takes the ' as the start of a quote. For any line with an odd number of 0\'x character code representations, add a ' in a comment to fix this.

Unfortunately, I cannot locate any similar facility in GNU Prolog. Anybody, how are literal character codes expressed in GNU Prolog source in terms of the ASCII character they represent?

Ron Stodden wrote:

Thanks, Alex. but your code has problems:

1. It will not deal with an empty stream. IOW the test for (not) end of stream must immediately follow the repeat. gprolog does not support a 'not' operator.

2. My experiments show that list decomposition is limited to the head item only. IOW [Head|Tail] works, but [Item1|Item2|Tail] will not produce your expected result.

3. Your case is limited to the processing of single lines. For example, using your technique one could not output a list of all the lines in a file because all data is lost at the fail of a repeat fail combination. That would require the use of persistent storage, ie a database or global variables.

4. The requirement to specify words as code lists is insufferably tedious.

Ron. [Melbourne, Australia]
"If you keep a green bough in your heart, the singing bird will come"
Get Fastest Mandrake downloader, English-only, from:    <--- Last Change 2nd November!

reply via email to

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