Domains
wordlist=symbol*
Predicates
word(wordlist)
num_lets(integer,wordlist)
long(integer,wordlist)
intersect(wordlist,wordlist,integer,integer)
extract(wordlist,integer,symbol)
crisscross(wordlist,wordlist,wordlist,wordlist)
Clauses
word([m,a,r,k,e,t]).
word([t,r,e,e,s]).
word([m,o,n,k,e,y]).
word([s,i,m,p,l,e]).
word([w,i,s,e]).
word([v,a,g,u,e]).
word([s,e,a]).
word([y,a,c,h,t]).
word([o,c,e,a,n]).
word([f,o,g,g,y]).
word([a,r,t,i,s,t]).
word([r,e,a,l,i,z,e]).
word([b,r,a,v,e]).
word([q,u,i,t,e]).
num_lets(0,[]).
num_lets(T,[M1|M2]):-num_lets(T1,M2),T=T1+1.
long(T,M):-word(M),num_lets(T,M).
intersect(C1,C2,N1,N2):-extract(C1,N1,R),extract(C2,N2,R).
extract([C1|C2],1,C1).
extract([C1|C2],N,R):-M=N-1,extract(C2,M,R).
crisscross(M1,M2,M3,M4):-long(5,M1),long(6,M2),intersect(M1,M2,3,2),
long(7,M3),intersect(M2,M3,5,2),long(5,M4),
intersect(M3,M4,5,3).
Goal
crisscross(M1,M2,M3,M4),write(M1),nl,write(M2),nl,write(M3),nl,write(M4),nl.
               (
geocities.com/v.iniestra/apuntes)                   (
geocities.com/v.iniestra)