Yury Luneff wote :
You see, I've got something like this:
| ?- read(Hello).
Hello.

yes
| ?- write(Hello).
_16

This is not what I've expected to see and because of this my program
doesn't work as it should. What do I have to do with this or
everything's normal?

You have to look at the syntax of Prolog terms. I suppose you want to read/write the constant "Hello". In Prolog a constant must be quoted like this 'Hello'. However, for a easier use, a constant which begins with a lower case letter (a-z) and followed by letters, digits or _ does not need quotes. So 'hello' can be simply written as hello (without quotes) but 'Hello' cannot be written without quotes. Indeed, if the first character is an upper case letter (A-Z) then it is considered as the name of a variable (not a constant). So use :

| ?- read(X).
'Hello'.

X = 'Hello'

yes
| ?- write('Hello').
Hello

yes






_______________________________________________
Users-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/users-prolog

Reply via email to