boolean-expr: use sequences:partition

factor-shell
Alexander Iljin 2018-01-22 01:30:52 +01:00
parent 2a3b917297
commit 1b41bf3cfa
1 changed files with 1 additions and 4 deletions

View File

@ -65,11 +65,8 @@ GENERIC: satisfiable? ( expr -- ? )
METHOD: satisfiable? { } drop t ;
METHOD: satisfiable? { ⊥ } drop f ;
: partition ( seq quot -- left right )
[ [ not ] compose filter ] [ filter ] 2bi ; inline
: (satisfiable?) ( seq -- ? )
[ \ ¬ instance? ] partition [ x>> ] map intersect empty? ;
[ \ ¬ instance? ] partition swap [ x>> ] map intersect empty? ;
METHOD: satisfiable? { □ }
cnf [ (satisfiable?) ] any? ;