/*-------------------------------------------------------------------------
    program: permuting a list of items
    file:    perm2
    date:    December 97
    updated: Pablo Lopez (lopez@lcc.uma.es)
             Dept. of CS
             University of Malaga, SPAIN

    notes:   This code is a Forum version of a Lolli example originally
             proposed by Joshua S. Hodas and Dale Miller in
             "Logic Programming in a Fragment of Intuitionistic Linear Logic"
             Information and Computation, 110(2), pp. 327-365, 1994.

    sample goal:
         perm([1,2,3],X).
-------------------------------------------------------------------------*/

module perm2.

put([X|Xs]) *- item(X) # put(Xs).
put([]) *- take([]).

take(Xs) # item(X) *- take([X|Xs]).

take(X) # get(X).

perm(X,Y) *- put(X) # get(Y).

go(X) <= perm([a,b,c,d,e,f,g,h,i,j,k,l],X).


