Discussions related to Visual Prolog
-
Ferenc Nagy
- VIP Member
- Posts: 289
- Joined: 24 Apr 2007 12:26
Unread post
by Ferenc Nagy » 24 Apr 2016 7:01
I have defined a
When I wanted to pass a variable from this domain to a procedure having string arguments
Code: Select all
Species="cat",
V_String=toString(Species)
resulted result
surrounded by double quotes.
The conversion
Code: Select all
Species="cat",
V_String=tryConvert(string,Species)
resulted
unchanged string.
The complier warned me sometimes about
"superfluous conversion from species to string".
TIA, Regards,
Frank Nagy
-
Thomas Linder Puls
- VIP Member
- Posts: 1625
- Joined: 28 Feb 2000 0:01
Unread post
by Thomas Linder Puls » 24 Apr 2016 21:16
toString will "write" any term to the string in the serialization format used by toTerm/tryToTerm which is the same format used by save/consult/writeQuoted/read.
tryConvert will convert a value which is convertible to a string to that string. For strings that would mean any subtype of string and symbol; the value will not change only the type will change because such values are already strings.
Regards Thomas Linder Puls
PDC
-
Ferenc Nagy
- VIP Member
- Posts: 289
- Joined: 24 Apr 2007 12:26
Unread post
by Ferenc Nagy » 25 Apr 2016 6:27
Thomas,
Thank you for the simple and logic explanation.
TIA, Regards,
Frank Nagy