Re: string_lower producing atoms

Michael Hendricks <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAFHuXuY9ZPBAiUvT_25YqMmcTrm6yPz9W7vwdPjYe4oWrdoqHg@mail.gmail.com>
On Tue, Mar 11, 2014 at 6:02 AM, Peter Berry <[email protected]> wrote:

> ?- string_lower("Foo", X), X = "foo".
> false.
>
> ?- string_lower("Foo", X).
> X = foo.
>
> ?- string_lower("Foo", "foo").
> true.
>
>
> Is there any particular reason for this? Isn't the point of strings to
> avoid the overhead associated with atoms?
>

It looks like string_lower/2 is using a slightly more general definition of
"string" which includes both string objects and atoms.  For example, you
can also provide an atom as the first argument.

Since we already have downcase_atom/2, I can't think of any reason why we'd
want string_lower/2 to behave this way.

-- 
Michael
-------------- 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.