/* String prepend (Rosetta code) in Picat. http://rosettacode.org/wiki/String_prepend """ Create a string variable equal to any text value. Prepend the string variable with another string literal. If your language supports any idiomatic ways to do this without referring to the variable twice in one expression, include such solutions. To illustrate the operation, show the content of the variable. """ This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ % import util. % import cp. main => go. go => S = "123456789", println(S), S := "A" ++ S, println(S), % append append("B",S,T), S := T, println(S), % insert at position S := insert(S,1,'C'), % note: must be a char to keep it a proper string println(S), % insert many characters S := insert_all(S,1,"DE"), println(S), nl.