I'm trying to find out how to concatenate two atoms:
A = 'my ', B = 'atom',
How can I concatenate these two atoms so that the result is:
'my atom'
?
Concatenation is the process of appending one string to the end of another string. You concatenate strings by using the + operator. For string literals and string constants, concatenation occurs at compile time; no run-time concatenation occurs.
Use CONCATENATE, one of the text functions, to join two or more text strings into one string.
It can be done by using append. concatenate(List1, List2, Result):- append(List1, List2, Result). Hope this helps. Save this answer.
For atoms:
?- atom_concat('my ', 'atom', X). X = 'my atom'.
For strings:
:- set_prolog_flag(double_quotes, chars). :- use_module(library(double_quotes)). ?- append("my ", "string", X). X = "my string".
It took me a while to find the proper names. Maybe it will help others too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With