boolean-expr: use sequences:partition
parent
2a3b917297
commit
1b41bf3cfa
|
@ -65,11 +65,8 @@ GENERIC: satisfiable? ( expr -- ? )
|
||||||
METHOD: satisfiable? { ⊤ } drop t ;
|
METHOD: satisfiable? { ⊤ } drop t ;
|
||||||
METHOD: satisfiable? { ⊥ } drop f ;
|
METHOD: satisfiable? { ⊥ } drop f ;
|
||||||
|
|
||||||
: partition ( seq quot -- left right )
|
|
||||||
[ [ not ] compose filter ] [ filter ] 2bi ; inline
|
|
||||||
|
|
||||||
: (satisfiable?) ( seq -- ? )
|
: (satisfiable?) ( seq -- ? )
|
||||||
[ \ ¬ instance? ] partition [ x>> ] map intersect empty? ;
|
[ \ ¬ instance? ] partition swap [ x>> ] map intersect empty? ;
|
||||||
|
|
||||||
METHOD: satisfiable? { □ }
|
METHOD: satisfiable? { □ }
|
||||||
cnf [ (satisfiable?) ] any? ;
|
cnf [ (satisfiable?) ] any? ;
|
||||||
|
|
Loading…
Reference in New Issue