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

pl/prolog/pllib/permutation.txt · ostatnio zmienione: 2017/07/17 08:08 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0