Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!news.sprintlink.net!sunserver.insinc.net!cato.Direct.CA!vanbc.wimsey.com!news.bc.net!newsserver.sfu.ca!fornax!jamie
From: jamie@cs.sfu.ca (Jamie Andrews)
Subject: Re: Permutation Predicate in Prolog.
Message-ID: <1994Nov15.190120.11148@cs.sfu.ca>
Organization: Faculty of Applied Science, Simon Fraser University
References: <Cz9DzI.1GB@westminster.ac.uk>
Date: Tue, 15 Nov 1994 19:01:20 GMT
Lines: 19

In article <Cz9DzI.1GB@westminster.ac.uk>,
Kaustav Bhattacharya <tjdec@westminster.ac.uk> wrote:
>Can anybody help me out with creating a permutation predicate in Prolog.  I'm
>really stuck.  All it needs to do is take in a list of numbers and produce a
>permutation of all the numbers in every posible order.

     I won't tell you how, but I'll ask some leading questions.
Remember that perm(X, Y) is, in the end, a formula expressing a
relationship between X and Y:  namely, that Y is a permutation
of X.  Now:

- If X is the empty list [], what values can Y have for Y to be
  a permutation of X?

- If perm(X, Y) holds, and X' is X with one more element, what
  values can Y' have for Y' to be a permutation of X'?

hope this helps
--Jamie.
