Re: Suggestions for dcg_basics

"Richard A. O'Keefe" <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 18/10/2013, at 3:16 AM, Jan Wielemaker wrote:

> On 10/17/2013 02:56 AM, Richard A. O'Keefe wrote:
>> (By the way, string//1 is a *bad* name for this predicate because it is
>> *NOT* in any way restricted to strings. 

> Not sure I agree here.  The library as a whole is defined to do meaningful things with strings of character codes, such as parsing
> numbers, skipping blanks, etc.  In that context string//1 is IMHO
> a fair name.  This doesn't exclude an equivalent predicate with
> a different name that fits another domain.

How many copies of append/3 do we need?

In a "library" which "is defined to do meaningful things with strings
of character codes, such as parsing numbers, skipping blanks, etc.",
I expect string//1 to match a string literal.

In fact, *especially* in such a library do I expect it to
match nothing other than a string literal.

Like the attached code, which may be of use to somebody. 
(I wanted to put it inline, but
TextEdit/Copy + Mail/Paste flattened it into a sequence of words.
How do I get that combination to preserve layout?)
This code has been *partly* tested, but not really thoroughly.
I whipped it up just now to make a point.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: string.pl
Type: text/x-perl-script
Size: 6129 bytes
Desc: not available
URL: <https://lists.iai.uni-bonn.de/pipermail/swi-prolog/attachments/20131018/2262a17d/attachment.bin>
-------------- next part --------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.