: has-all? ( tested-seq requirements-seq -- ? ) [ swap member? ] with map [ ] all? ; : have-all ( seq^2 requirements-seq -- matches ) '[ _ has-all? ] filter ; : most-is-n ( seq -- n/2+1 ) length 2 /i 1+ ; : most-items ( seq^2 -- most-seq ) [ concat ] [ most-is-n 1- ] bi [ duplicates ] times prune ; ! I'm not sure about the use of duplicates here, though it seems like it's correct : mostly-intersect ( seq^2 -- seq ) dup most-items have-all ;