Variation

Description

Program create variation without repeated list elements

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

Download

Program source code: variation.pl

Listing

varia(0,_,[]).
varia(N,L,[H|Varia]):-N>0,N1 is N-1,delete(H,L,Rest),varia(N1,Rest,Varia).
 
delete(X,[X|T],T).
delete(X,[H|T],[H|NT]):-delete(X,T,NT).

Comments

pl/prolog/pllib/variation.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