Re: Ann: SWI-Prolog 6.5.3

Boris Vassilev <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAFw8osKsmsX-SawAQL10Jcw7SBqH+jwJ2LKSD1+3ksmwC5wRNQ@mail.gmail.com>
P.S. And there is actually no immediately obvious "sub_list" built-in list
predicate for efficient searching for (overlapping) substrings in a
list.... Or again, I have not paid enough attention when reading.


On Thu, Nov 21, 2013 at 3:10 PM, Boris Vassilev
<[email protected]>wrote:

>
> On Thu, Nov 21, 2013 at 12:45 PM, Jan Wielemaker <[email protected]>wrote:
>
>> The main point of strings is that they are *not* lists, so you know "ab"
>> is a string and not a list of two percentages ([97,98]). The NU Prolog
>> approach hides this detail, turning it only into an implementation
>> detail. Yes, you can represent any text as a SWI-Prolog atom. However,
>> this ignores the conceptual difference as well as the ability to exploit
>> runtime type information. There is also an important implementation
>> detail missing: atoms are expensive, in particular as a short-lived
>> datastructure. Nevertheless, we see that many applications do a lot of
>> sub_atom/5 and atom_concat/3 calls to do string manipulation with atoms.
>> Such applications tend to be slow, in particular if it concerns
>> multi-threaded servers. Most of these applications should be using the
>> list representation. Apparently many users do no like using lists for
>> text processing. I think one of the reasons is that it is often hard to
>> debug.
>>
>
>
> Starting without much experience with Prolog, and reading the manual, esp:
>
> http://www.swi-prolog.org/pldoc/man?section=strings
>
> "Although strings and atoms still have different features, new code should
> consider using atoms to avoid too many representations for text as well as
> for compatibility with other Prolog implementations."
>
> had led me to believe that I should, after all, be using atoms and not
> strings for representing text. Combined with not too many of the
> "established" Prolog tutorials/books even mentioning strings, it is not
> surprising that many applications use atoms with sub_atom/5 and
> atom_concat/3.
>
> If you actually think that strings are better suited for text you maybe
> should re-word the string section of the manual. (but this is probably
> happening anyway in V7?)
>
> Cheers,
> Boris
>
> --
> Boris Vassilev
> +358 9 191 25266
> Intracellular Cholesterol Trafficking Lab
> Institute of Biomedicine, Anatomy
> P.O. Box 63 (Haartmaninkatu 8)
> FI-00014 University of Helsinki, Finland
>



-- 
Boris Vassilev
+358 9 191 25266
Intracellular Cholesterol Trafficking Lab
Institute of Biomedicine, Anatomy
P.O. Box 63 (Haartmaninkatu 8)
FI-00014 University of Helsinki, Finland
-------------- next part --------------
HTML attachment scrubbed and removed
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.