Logic Programming
What
versus
How
 

Lessons Epilog Sierra Examples Games


Write a logic program that defines the binary relation permutations, where the first argument is a list (e.g. [a,b]) with no repeated elements and the second argument is a list of its permutations (e.g. [[a,b],[b,a]]). You can assume that the elements of the "input" list are object constants (e.g. a, b, c, and so forth). Your program should succeed on all queries in which the first argument to permutations is a ground set in list notation and the second argument is a variable.