users-prolog
[Top][All Lists]
Advanced

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

Re: How to read a line of text?


From: Vic Bancroft
Subject: Re: How to read a line of text?
Date: Wed, 7 Jan 2004 00:14:32 -0500 (EST)

On Sun, 4 Jan 2004, Ron Stodden wrote:

> How to read lines from a text file to a list in gprolog?

Have you tried open/3 ?  This can be used to create a Stream that can then 
be read one character at a time using get_code/2  . . . 
 
> I have unsuccessfully tried all the read variants, the best so far being 
> read_char, but that leads to 'atom table full' under gplc when reading a 
> text file of 3090 lines, 238,153 characters on my 256KB ram machine.   
> That is no good, period!

Yea, many of the predicates are for reading and parsing prolog code.

> I feel a read_line description must be missing from the documentation?

One can construct such a thing, though it might be fun to do some wrapper 
for the GNU readline library.
 
> There are no examplesPL of any input/output!

Perhaps one can see the idea from a working example,

  http://aisun0.ai.uga.edu/~bancroft/pub/gplfaq/faq_parse.pl

That code runs over the gprolog mailing list archives without difficulty.
It even records every word with occurrence counts, two place transitions 
between words with occurrence counts, three place transitions with 
occurrence counts and messege intervals.  I have run it across a archive 
file that is 1.8M . . . 

more,
l8r,
v

-- 
No bugs were harmed in the development of this software. 

http://elvis.dlogic.org/~bancroft/tiki





reply via email to

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