title: How to append an element to a list in a forall?
body: <p>Basically trying to append <code>D</code> to a list in a <code>forall</code> so I can then sort this list and extract the smallest value. Here's what I've tried so far:</p>
  <pre><code>smallest_distance( W ) :-
      forall( a( S1, S2 ), ( w( S1, S2, D ), append([D], Xs, Ls ), Xs = Ls ) ),
      sort(Xs, [W|_]).
  </code></pre>