For Programmers: Free Programming Magazines  


Home > Archive > Prolog > May 2006 > String is not string in SWI-Prolog ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author String is not string in SWI-Prolog ?
newser.bbs@bbs.ee.ncu.edu.tw

2006-05-17, 4:03 am

Something strange for the predicate string. Or I just misunderstand the

function for the predicate string/1. But the on-line manual says :
string(+Term)
Succeeds if Term is bound to a string.

Please look:
---------------------------------
Welcome to SWI-Prolog (Multi-threaded, Version 5.6.12)
Copyright (c) 1990-2006 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

1 ?- string('Is this a string').

No
2 ?- string(Is_this_a_string).

No
3 ?- string(is_this_a_string).

No
4 ?- copy_term('Is this a string?',YesOrNo),
| string(YesOrNo).

No
5 ?-

Bart Demoen

2006-05-17, 4:03 am

newser.bbs@bbs.ee.ncu.edu.tw wrote:
> Something strange for the predicate string. Or I just misunderstand the
>
> function for the predicate string/1. But the on-line manual says :
> string(+Term)
> Succeeds if Term is bound to a string.
>
> Please look:
> ---------------------------------
> Welcome to SWI-Prolog (Multi-threaded, Version 5.6.12)
> Copyright (c) 1990-2006 University of Amsterdam.
> SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
> and you are welcome to redistribute it under certain conditions.
> Please visit http://www.swi-prolog.org for details.
>
> For help, use ?- help(Topic). or ?- apropos(Word).
>
> 1 ?- string('Is this a string').
>
> No
> 2 ?- string(Is_this_a_string).
>
> No
> 3 ?- string(is_this_a_string).
>
> No
> 4 ?- copy_term('Is this a string?',YesOrNo),
> | string(YesOrNo).
>
> No
> 5 ?-
>


You certainly have not looked further than your silly experiment.
Find out about the Prolog flag backquoted_string. Use your brain, not
just your fingers while posting.

And then admit you have learned something from me.


newser.bbs@bbs.ee.ncu.edu.tw

2006-05-17, 4:03 am


Bart Demoen wrote:
....

BE A GENTLEMAN !!!

newser.bbs@bbs.ee.ncu.edu.tw

2006-05-17, 4:03 am

> Bart Demoen wrote:
> ...
>
> BE A GENTLEMAN !!!


If you don't know what that sentence mean ,
just look at
(http://groups.google.com.tw/group/c...47?dmode=source)
I don't want to argue with you anymore .

A..L.

2006-05-17, 8:03 am

On 17 May 2006 01:47:25 -0700, newser.bbs@bbs.ee.ncu.edu.tw wrote:

>
>Bart Demoen wrote:
>...
>
>BE A GENTLEMAN !!!


Be a member of my Kill File.

A.L.
A..L.

2006-05-17, 8:03 am

On Wed, 17 May 2006 07:18:46 -0500, A..L. <alewando@fala2005.com>
wrote:

>On 17 May 2006 01:47:25 -0700, newser.bbs@bbs.ee.ncu.edu.tw wrote:
>
>
>Be a member of my Kill File.
>
>A.L.


Of course, not Bart. This is newser.bbs who is already there.

A.L.
Joachim Schimpf

2006-05-17, 8:03 am

A..L. wrote:
> On 17 May 2006 01:47:25 -0700, newser.bbs@bbs.ee.ncu.edu.tw wrote:
>
>
> Be a member of my Kill File.
>
> A.L.


Don't be so hard on newser.bbs@bbs.ee.ncu.edu.tw!

I think (s)he is a candidate in a TV game show: the challenge is
to learn Prolog purely by trial and error. He is locked up in a
house with a computer that only has SWI-Prolog and a newsreader
installed. He is not allowed to read any textbooks or manuals,
he can only ask help from the audience via usenet posting.

Am I right?

-- Joachim
Nick Wedd

2006-05-17, 7:03 pm

In message <1147856710.120290.184670@j33g2000cwa.googlegroups.com>,
newser.bbs@bbs.ee.ncu.edu.tw writes
>
>If you don't know what that sentence mean ,
>just look at
>(http://groups.google.com.tw/group/c...d0bf3fe587a2347
>?dmode=source)
>I don't want to argue with you anymore .


He wasn't arguing. He was trying to help you to learn Prolog, by
encouraging you to read your manual. If he has shown a fault, it is
optimism.

Have you tried calling string/1 with a string as its argument?

Nick
--
Nick Wedd nick@maproom.co.uk
Cesar Rabak

2006-05-17, 7:03 pm

NNTP-Posting-Host: RlVd++5HrKvzofRtoX/5wQ.user.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
In-Reply-To:
X-Accept-Language: pt-br, pt
User-Agent: Mozilla Thunderbird 1.0.6-6mdk (X11/20050322)
Xref: number1.nntp.dca.giganews.com comp.lang.prolog:30424

Joachim Schimpf escreveu:
[snipped]

>
> Don't be so hard on newser.bbs@bbs.ee.ncu.edu.tw!
>
> I think (s)he is a candidate in a TV game show: the challenge is to
> learn Prolog purely by trial and error. He is locked up in a house
> with a computer that only has SWI-Prolog and a newsreader installed.
> He is not allowed to read any textbooks or manuals, he can only ask
> help from the audience via usenet posting.
>
> Am I right?
>

Humm... Joachim 'cause of certain repetitions I would bet 0.019999...
that it is a bot ;-)
Cesar Rabak

2006-05-17, 7:03 pm

Nick Wedd escreveu:
> In message <1147856710.120290.184670@j33g2000cwa.googlegroups.com>,
> newser.bbs@bbs.ee.ncu.edu.tw writes

[snipped]

>
>
> He wasn't arguing. He was trying to help you to learn Prolog, by
> encouraging you to read your manual. If he has shown a fault, it is
> optimism.
>
> Have you tried calling string/1 with a string as its argument?
>

Nick,

Probably [s]he will explain you in haste that the non understandig of
what a string is stems from the fact it wasn't in {her|his} job
responsibility. . .
Bart Demoen

2006-05-17, 7:03 pm

NNTP-Posting-Host: seven.kulnet.kuleuven.ac.be
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: ikaria.belnet.be 1147904929 11192 134.58.127.12 (17 May 2006 22:28:49 GMT)
X-Complaints-To: abuse@belnet.be
NNTP-Posting-Date: Wed, 17 May 2006 22:28:49 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050927 Debian/1.7.8-1sarge3
X-Accept-Language: en
In-Reply-To: <%IFag.215$ll.11@newsfe2-win.ntli.net>
Cache-Post-Path: seven.kulnet.kuleuven.ac.be!unknown@10-91-129-84.kotnet.org
X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/)
Xref: number1.nntp.dca.giganews.com comp.lang.prolog:30427

Joachim Schimpf wrote:

> Don't be so hard on newser.bbs@bbs.ee.ncu.edu.tw!
>
> I think (s)he is a candidate in a TV game show: the challenge is
> to learn Prolog purely by trial and error. He is locked up in a
> house with a computer that only has SWI-Prolog and a newsreader
> installed. He is not allowed to read any textbooks or manuals,
> he can only ask help from the audience via usenet posting.
>
> Am I right?
>
> -- Joachim


I think Joachim is right. And (s)he probably gets a bonus every time
(s)he can annoy the hell out of someone. That's why I am trying to be
helpful without showing any excessive emotions :-)

Joachim, how is ECLiPSe at the moment ? We don't want it to disappear:
it is too good for that. Even more: we want it to become more visible !
ECLiPSe is a fine product whose visibility and availability increases
its use and acceptance. Hiding it can serve no purpose, and surely is
commercially counterproductive.

Cheers

Bart
newser.bbs@bbs.ee.ncu.edu.tw

2006-05-17, 10:01 pm


A..L. wrote:
> Be a member of my Kill File.


BE A GENTLEMAN

newser.bbs@bbs.ee.ncu.edu.tw

2006-05-17, 10:01 pm

Nick Wedd wrote:
> He wasn't arguing. He was trying to help you to learn Prolog, by
> encouraging you to read your manual. If he has shown a fault, it is
> optimism.
>
> Have you tried calling string/1 with a string as its argument?


Yes I have checked manual and tried calling string/1 with a string as
its argument.
In fact , I not only checked manual , but also wrote it down.
I not only called string/1 with a string as argument , but also called
in many forms.
You can see my first post :
http://groups.google.com.tw/group/c...6?dmode=source.

Thank you !

newser.bbs@bbs.ee.ncu.edu.tw

2006-05-17, 10:01 pm

Joachim Schimpf wrote:
> Don't be so hard on newser.bbs@bbs.ee.ncu.edu.tw!
> I think (s)he is a candidate in a TV game show: the challenge is
> to learn Prolog purely by trial and error. He is locked up in a
> house with a computer that only has SWI-Prolog and a newsreader
> installed. He is not allowed to read any textbooks or manuals,
> he can only ask help from the audience via usenet posting.


BE A GENTLEMAN.

newser.bbs@bbs.ee.ncu.edu.tw

2006-05-17, 10:01 pm

Bart Demoen wrote:
> I think Joachim is right. And (s)he probably gets a bonus every time
> (s)he can annoy the hell out of someone. That's why I am trying to be
> helpful without showing any excessive emotions :-)


Are you helpful ? "Check Manual" well before you answer .
What you say is nearly always "check manual , chack manual".
No one needs help of this knind.
I won't say that you know nothing other than such slogan "check
manual",
but you don't show willingness to share your knowledge .And you are
only
willing to share this slogan "check manual" .

If you don't want to help , just shut up and go away .
If you want help , please give the real help .

Although I need help in some problems , but I am willing to help
people if I can . In fact , I did help. You can check
http://groups.google.com.tw/group/c...ource&hl=zh-TW;
http://groups.google.com.tw/group/c...ource&hl=zh-TW;
http://groups.google.com.tw/group/c...ource&hl=zh-TW;
I explained things in details , not just the slogan "check manual" as
you
usually do.

And I also am willing to share my codes with others , you can check
http://groups.google.com.tw/group/c...dbf7ed5317332bf
Although somebody says that I am reinventing the wheel ,
I still like to share my wheel with others . And you , what do you want
to
share with people other than the slogan "check manual"?

So , if you just want to say "check manual" to me or to other people,
just
keep your mouth closed , because we know that very well for you have
told too many times. Not for prevention form anoying us, but just for
saving
your time , if you don't want to help , just go away .

Pierpaolo BERNARDI

2006-05-18, 4:01 am

On Thu, 18 May 2006 04:03:23 +0200, <newser.bbs@bbs.ee.ncu.edu.tw> wrote:

> Nick Wedd wrote:
>
> Yes I have checked manual and tried calling string/1 with a string as
> its argument.


No. You have called string/1 with atoms and with a variable as argument.

'this is an atom', This_is_a_variable, this_is_an_atom_too.

Read sections 4.23 and 2.11 of the swi manual.

A good idea would be also to read the manual from cover to cover,
at least once. It takes a lot of time, but is necessary.

Cheers
P.

--
Anything below this line is being added by the newsserver

Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
newser.bbs@bbs.ee.ncu.edu.tw

2006-05-18, 4:01 am

Pierpaolo BERNARDI wrote:
> No. You have called string/1 with atoms and with a variable as argument.
>
> 'this is an atom', This_is_a_variable, this_is_an_atom_too.
>
> Read sections 4.23 and 2.11 of the swi manual.


Thank you for trying to help me by showing a sections for me to read.
But some problem happens to me .

I download SWI manual from
http://gollem.science.uva.nl/cgi-bi...fman/refman.pdf
and it doesn't contains the section of 4.23
and as to 2.11 , it mentioned how to start using SWI prolog (on unix ,
on
windows , querying ), nothing to do with string .

And I search 'string' in the manual and get from page 16 the followings
"handling strings as lists of onecharacter atoms is now supported"
but you can see what I get while I tried in SWI prolog
---------------------------------------------------------------------------------
Welcome to SWI-Prolog (Multi-threaded, Version 5.2.13)
Copyright (c) 1990-2003 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

1 ?- string([i,s]).

No
2 ?- string([I,s,' ',t,h,i,s,' ',a,' ',s,t,r,i,n,g]).

No
3 ?- string([I,s,' ',t,h,i,s,' ',a,' ',s,t,r,i,n,g]).

No
4 ?- string(['I','s',' ','t','h','i','s',' ','a','
','s','t','r','i','n','g']).

No
5 ?-
-----------------------------------------------------------------------------------------------

For finding a real example of string in SWI prolog , I use the
procedure
string_to_atom/2 and get the following results:

+++++++++++++++++++++++++++++++++++++++
Welcome to SWI-Prolog (Multi-threaded, Version 5.2.13)
Copyright (c) 1990-2003 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

1 ?- string_to_atom(String,string_or_atom).

String = "string_or_atom"

Yes
2 ?- string("string_or_atom").

No
3 ?-
++++++++++++++++++++++++++++++++++++++++
++

See ? The SWI prolog says that a sting is not a string ,
even though the example of string was given by SWI prolog
itself.

Robby Goetschalckx

2006-05-18, 4:01 am

newser.bbs@bbs.ee.ncu.edu.tw wrote:

> 1 ?- string_to_atom(String,string_or_atom).
>
> String = "string_or_atom"
>
> Yes
> 2 ?- string("string_or_atom").
>
> No
> 3 ?-
> ++++++++++++++++++++++++++++++++++++++++
++
>
> See ? The SWI prolog says that a sting is not a string ,
> even though the example of string was given by SWI prolog
> itself.


?- string_to_atom(X,string_or_atom),string(
X).

X = "string_or_atom" ;

No

The SWI manual states in section "4.23 Representing text in strings" :

"String objects by default have no lexical representation and thus can
only be created using the predicates below or through the foreign
language interface (See chapter 9)."

kind regards,

robby
Pierpaolo BERNARDI

2006-05-18, 8:02 am

On Thu, 18 May 2006 08:07:41 +0200, <newser.bbs@bbs.ee.ncu.edu.tw> wrote:

> Pierpaolo BERNARDI wrote:
>
> Thank you for trying to help me by showing a sections for me to read.
> But some problem happens to me .
>
> I download SWI manual from
> http://gollem.science.uva.nl/cgi-bi...fman/refman.pdf
> and it doesn't contains the section of 4.23
> and as to 2.11 , it mentioned how to start using SWI prolog (on unix ,
> on
> windows , querying ), nothing to do with string .


I'm referring to the builtin manual. Maybe the pdf has a different numbering
of its sections.

When you start swi it displays: For help, use ?- help(Topic). or ?- apropos(Word).

You may also use help with no arguments. Use this feature.

> And I search 'string' in the manual and get from page 16 the followings
> "handling strings as lists of onecharacter atoms is now supported"
> but you can see what I get while I tried in SWI prolog


These kind of strings are not what the predicate string/1 recognizes.

> For finding a real example of string in SWI prolog , I use the
> procedure
> string_to_atom/2 and get the following results:


Strings are not used much as far as I know.

Either use lists of char codes, or lists of one character atoms,
or atoms.

> 1 ?- string_to_atom(String,string_or_atom).
>
> String = "string_or_atom"
>
> Yes
> 2 ?- string("string_or_atom").
>
> No
> 3 ?-
> ++++++++++++++++++++++++++++++++++++++++
++
>
> See ? The SWI prolog says that a sting is not a string ,
> even though the example of string was given by SWI prolog
> itself.


In this case, I agree that what what swi prints is not reasonable.

It is not reasonable to print strings with a syntax that when read back
means a different thing.

I think nobody complained about this because nobody uses swi strings.

P.

--
Anything below this line is being added by the newsserver

Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
Mauro Di Nuzzo

2006-05-18, 7:06 pm

SWI Prolog STRING type deals with an internal representation. So the
predicate string/1 can succeed ONLY within a goal in which a string is
"created" by means of a logical conversion (from atom or list).
This is why the following two goals have a different behaviour:

?- string_to_atom(S, 'Mauro'), string(S).
S = "Mauro"
Yes

?- string('Mauro').
No

In this context the prolog flag backquoted_string add nothing but the way in
which the STRING type is represented (like a char-code or like an atom).
That is:

?- set_prolog_flag(backquoted_string, true), string_to_atom(S, 'Mauro'),
string(S).
S = 'Mauro'
Yes

Note the difference with the other. I remember you that "Mauro" is currently
a list of character codes, while 'Mauro' is an atom.
So, finally, SWI Prolog offers you the possibility of creating the type
string from another "native" Prolog type. This datatype is handled
differently from the system (for some advantages). In fact, to handle
strings you CAN (not MUST) to use dedicated predicates, such as
string_concat/3 instead of atom_concat/3.
I think few use strings in prolog (maybe they are useful in some specific
applications, I do not know...).

Post scriptum:
Personally, I read these messages not because I have nothing better to do,
but because I hope to be useful to someone. On the other hand, I noticed
that I receive vey few answers to my messages, and this is a delusion,
sometimes.

Regards,
/\/\



Mauro Di Nuzzo

2006-05-18, 7:06 pm

> ...
> This is why the following two goals have a different behaviour:
>
> ?- string_to_atom(S, 'Mauro'), string(S).
> S = "Mauro"
> Yes
>
> ?- string('Mauro'). % <<<<<<<<<<<<<< read >>>>>>>>>

string("Mauro")
> No
> ...



Bart Demoen

2006-05-18, 7:06 pm

newser.bbs@bbs.ee.ncu.edu.tw wrote:

> Are you helpful ? "Check Manual" well before you answer .
> What you say is nearly always "check manual , chack manual".
> No one needs help of this knind.


You are mistaken. You should know the chinese proverb:
“Give a person a fish and you feed him for a day; teach a person
to fish and he'll eat forever.”

That's what I am trying to do: teach you to fish in the manual.

And I usually indicate where in the manual it is worth fishing.
Bart Demoen

2006-05-18, 7:06 pm

newser.bbs@bbs.ee.ncu.edu.tw wrote:
> Pierpaolo BERNARDI wrote:
>
>
>
> Thank you for trying to help me by showing a sections for me to read.
> But some problem happens to me .
>
> I download SWI manual from
> http://gollem.science.uva.nl/cgi-bi...fman/refman.pdf
> and it doesn't contains the section of 4.23



I am afraid I will have to teach you to deal with information from
Pierpaolo and also how to read manuals.
First: if Pierpaolo says it is in section 4.23, assume he is correct.
If you don't find it, assume you haven't searched correctly and search
again. Make allowance for him meaning chapter, paragraph or whatever.

If you still haven't found it, go to the glossary of the manual.
Look for string - if you can't find it, just go sequentially over all
items, or use a search facility of your pdf reader. The item for string
refers to 4.23 and if you click on it, you will be directed there,
assuming your pfd reader has that facility. If it doesn't you should
still see that there is a 4.23 and look for it until you find it ...

Reading a manual: one of the few martial arts a programmer should
master in his battle with programming languages.


> and as to 2.11 , it mentioned how to start using SWI prolog (on unix ,
> on
> windows , querying ), nothing to do with string .


Section 2.11 is about prolog_flags. Starting a search in this section
for string, brings you immediately to backquoted_string which I directed
you to earlier. Again you have failed ...


> See ? The SWI prolog says that a sting is not a string ,
> even though the example of string was given by SWI prolog
> itself.
>


The gentleman thing to say would have been that there seems a
discrepancy between the SWI manual and implementation and that you
wonder what/how/why. Maybe a question like "how come the situation
about strings is not clear cut in (SWI) Prolog" would be appropriate.
And if you would have cared to read a book on Prolog, you would have
found out that string is not a standard Prolog type ...

I guess all this is too much to ask from a player in a reality show.
Cesar Rabak

2006-05-18, 7:06 pm

Bart Demoen escreveu:
[snipped]

>
> Reading a manual: one of the few martial arts a programmer should
> master in his battle with programming languages.

Bart,

Your phrase above has been kidnapped to my quotes file ;-)
Pierpaolo BERNARDI

2006-05-18, 7:06 pm

On Thu, 18 May 2006 19:33:58 +0200, Mauro Di Nuzzo <picorna@inwind.it> wrote:

> In this context the prolog flag backquoted_string add nothing but the way in
> which the STRING type is represented (like a char-code or like an atom).
> That is:
>
> ?- set_prolog_flag(backquoted_string, true), string_to_atom(S, 'Mauro'),
> string(S).
> S = 'Mauro'
> Yes


There's something wrong here.

Here's what I get, which agrees with what the manual says:

?- set_prolog_flag(backquoted_string,true),
string_to_atom(S,'Mauro').

S = `Mauro`

> Note the difference with the other. I remember you that "Mauro" is currently
> a list of character codes, while 'Mauro' is an atom.


That's what caused the confusion that started this thread. "Mauro" is read
as a list of character codes (if swi is in its default state), and strings
are printed with the same syntax (if swi is in its default state).

I think that having backquoted_string set to true as default in swi would
do no harm and would help avoid this confusion (unless I'm missing some
bad side effects of having it set to true).

> Post scriptum:
> Personally, I read these messages not because I have nothing better to do,
> but because I hope to be useful to someone. On the other hand, I noticed
> that I receive vey few answers to my messages, and this is a delusion,
> sometimes.


È la vita. :)

Ciao


--
Anything below this line is being added by the newsserver

Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
newser.bbs@bbs.ee.ncu.edu.tw

2006-05-19, 8:02 am

Bart Demoen wrote:
> I am afraid I will have to teach you to deal with information from
> Pierpaolo and also how to read manuals.
> First: if Pierpaolo says it is in section 4.23, assume he is correct.
> If you don't find it, assume you haven't searched correctly and search
> again. Make allowance for him meaning chapter, paragraph or whatever.
>
> If you still haven't found it, go to the glossary of the manual.
> Look for string - if you can't find it, just go sequentially over all
> items, or use a search facility of your pdf reader. The item for string
> refers to 4.23 and if you click on it, you will be directed there,
> assuming your pfd reader has that facility. If it doesn't you should
> still see that there is a 4.23 and look for it until you find it ...
>
> Reading a manual: one of the few martial arts a programmer should
> master in his battle with programming languages.
>
>
>
> Section 2.11 is about prolog_flags. Starting a search in this section
> for string, brings you immediately to backquoted_string which I directed
> you to earlier. Again you have failed ...
>

Thank you , that's really helpful.
I sincerely appreciate that .
Thank you again.

newser.bbs@bbs.ee.ncu.edu.tw

2006-05-19, 8:02 am


Mauro Di Nuzzo =E5=AF=AB=E9=81=93=EF=BC=9A

> SWI Prolog STRING type deals with an internal representation. So the
> predicate string/1 can succeed ONLY within a goal in which a string is
> "created" by means of a logical conversion (from atom or list).
> This is why the following two goals have a different behaviour:
>
> ?- string_to_atom(S, 'Mauro'), string(S).
> S =3D "Mauro"
> Yes
>
> ?- string('Mauro').
> No
>
> In this context the prolog flag backquoted_string add nothing but the way=

in
> which the STRING type is represented (like a char-code or like an atom).
> That is:
>
> ?- set_prolog_flag(backquoted_string, true), string_to_atom(S, 'Mauro'),
> string(S).
> S =3D 'Mauro'
> Yes
>
> Note the difference with the other. I remember you that "Mauro" is curren=

tly
> a list of character codes, while 'Mauro' is an atom.
> So, finally, SWI Prolog offers you the possibility of creating the type
> string from another "native" Prolog type. This datatype is handled
> differently from the system (for some advantages). In fact, to handle
> strings you CAN (not MUST) to use dedicated predicates, such as
> string_concat/3 instead of atom_concat/3.
> I think few use strings in prolog (maybe they are useful in some specific
> applications, I do not know...).
>
> Post scriptum:
> Personally, I read these messages not because I have nothing better to do,
> but because I hope to be useful to someone. On the other hand, I noticed


It really helps. Thank you ,sincerely.

> that I receive vey few answers to my messages, and this is a delusion,


OK , I'll try to share my ideas on your messages.
But don't laugh at me if my opinion is like from a fool.

> sometimes.
>=20
> Regards,
> /\/\


newser.bbs@bbs.ee.ncu.edu.tw

2006-05-19, 8:02 am

Bart Demoen wrote:
> You are mistaken. You should know the chinese proverb:
> "Give a person a fish and you feed him for a day; teach a person
> to fish and he'll eat forever."


Yes , there is such sayings in chinese.

> That's what I am trying to do: teach you to fish in the manual.
> And I usually indicate where in the manual it is worth fishing.


Yes , you did. But I am such a fool that I can't understand well
and I beg more details from you.

Mauro Di Nuzzo

2006-05-20, 4:07 am


Pierpaolo said me:

>
> È la vita. :)
>
> Ciao
>


That is:

??????
Man's schemes are inferior to those made by heaven.




<newser.bbs@bbs.ee.ncu.edu.tw> ha scritto nel messaggio
news:1148043638.980536.309410@u72g2000cwu.googlegroups.com...

Mauro Di Nuzzo ??:

> SWI Prolog STRING type deals with an internal representation. So the
> predicate string/1 can succeed ONLY within a goal in which a string is
> "created" by means of a logical conversion (from atom or list).
> This is why the following two goals have a different behaviour:
>
> ?- string_to_atom(S, 'Mauro'), string(S).
> S = "Mauro"
> Yes
>
> ?- string('Mauro').
> No
>
> In this context the prolog flag backquoted_string add nothing but the way

in
> which the STRING type is represented (like a char-code or like an atom).
> That is:
>
> ?- set_prolog_flag(backquoted_string, true), string_to_atom(S, 'Mauro'),
> string(S).
> S = 'Mauro'
> Yes
>
> Note the difference with the other. I remember you that "Mauro" is

currently
> a list of character codes, while 'Mauro' is an atom.
> So, finally, SWI Prolog offers you the possibility of creating the type
> string from another "native" Prolog type. This datatype is handled
> differently from the system (for some advantages). In fact, to handle
> strings you CAN (not MUST) to use dedicated predicates, such as
> string_concat/3 instead of atom_concat/3.
> I think few use strings in prolog (maybe they are useful in some specific
> applications, I do not know...).
>
> Post scriptum:
> Personally, I read these messages not because I have nothing better to do,
> but because I hope to be useful to someone. On the other hand, I noticed


It really helps. Thank you ,sincerely.

> that I receive vey few answers to my messages, and this is a delusion,


OK , I'll try to share my ideas on your messages.
But don't laugh at me if my opinion is like from a fool.

> sometimes.
>
> Regards,
> /\/\



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com