Variation 2

Description

Program create variation with repeated list elements

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

Download

Program source code: variation_2.pl

Listing

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

Comments

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