Re: SWI-Prolog 7.1.3
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 12/16/2013 03:01 AM, Richard A. O'Keefe wrote:
>
> On 14/12/2013, at 4:52 AM, Jan Wielemaker wrote:
>>
>> The current set of string operations will also appear in ECLiPSe and
>> YAP. Small changes are still possible, but I expect the set to be
>> stable.
>
> The current version of
> http://www.cs.otago.ac.nz/staffpriv/ok/pllib.htm
> has a section on string predicates.
We should check that. We now started with the set ECLiPSe
is using for many years. Joachim selected the subset he
considered vital. We synchronised the naming to use
the same conventions as ISO atom operations and cleaned
some things we thought were a bit inconsistent and
ECLiPSe can easily change without breaking compatibility.
> I have not been able to figure out any way to use the
> read_string predicates to do any of the string reading
> I have uses for; use cases for those predicates would
> be of interest to me.
The observation was that split_string/4 is very
useful. read_string/5 provides the same functionality
incrementally. It is fine to read a line, possibly
removing leading and trailing white space or read a field
from a file that uses several delimiters (field, line, ...).
All with or without removing (white space) padding.
Note that regexes will complete the picture. We then
have the usual stuff:
- split
- select sub string or test for sub string
- finding characters (but only from start end end,
might need a reverse here).
- Get characters at index
- Regex search and replace
And there is library(pure_input) to process files using
DCGs. This set covers most use cases I'm aware of and
allows for several (good and bad) styles of programming
we see around in the wild.
As you already invested some time, what precisely do we miss?
--- Jan
... will be doing mostly application programming the rest
of this year ...