/* Difference lists in Picat v3. Cf http://hakank.org/picat/difference_lists.pi (Picat v2 version). Examples from https://stackoverflow.com/questions/21199436/prolog-difference-list Note that one have to $ escape the lists. This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ main => go. go ?=> append_dl($[1,2,3|T]-T, $[4,5,6|W]-W, DL), println(t=T), println(w=W), println(dl=$DL), nl. go => true. % Extracting "plain" lists go2 ?=> append_dl($[1,2,3|T]-T, $[4,5,6|W]-W, $L-[]), println(t=T), println(w=W), println(l=L), nl. go2 => true. append_dl(A-B, B-C, A-C).