PPT Slide
This is the easiest and clearest way to construct dynamic assertions and calls.
-- The predicate f(a, b, c) corresponds to the list [ f, a, b, c ] .
-- The operator =.. converts back and forth between the two representations.
?- f(a, b, c) =.. X . X = [ f, a, b, c ] yes
?- X =.. [ w, x, y, z ] . X = w(x, y, z) . yes