Spis treści

Permutation

Description

A procedure calculates permutaion of the list.

Source: Guide to Prolog Programming (on-line tutorial)

Download

Program source code: permutation.pl

Listing

perm(List,[H|Perm]):-delete(H,List,Rest),perm(Rest,Perm).
perm([],[]).
 
delete(X,[X|T],T).
delete(X,[H|T],[H|NT]):-delete(X,T,NT).

Comments