Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  W in Wordlist,
  length(W,10),
  maplist(\L^memberchk(L,W),[a,b,c]),
  nth(10,W,k).


I 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.


Oh, 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))




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: