3 ms·
W in Wordlist, length(W,10), maplist(\L^memberchk(L,W),[a,b,c]), nth(10,W,k).
by Avshalom 3y ago
W in Wordlist,
length(W,10),
maplist(\L^memberchk(L,W),[a,b,c]),
nth(10,W,k).
- jodrellblank 3y agoI think memberchk will do one check for each letter (not checking the rest of the list and leaving no choice point) rather than checking each letter is present only once.
- Avshalom 3y agoOh, yeah, my brain skipped over that part of the constraint. Does ruin the simplicity a bit. (findall(C,member(L,W),S),length(S,1))