prune-redundant-predicates ( assoc -- default assoc' )


Vocabulary
generic.single

Definition
USING: combinators kernel sequences ;

IN: generic.single

: prune-redundant-predicates ( assoc -- default assoc' )
{
{ [ dup empty? ] [ drop [ unreachable ] { } ] }
{ [ dup length 1 = ] [ first second { } ] }
{
[ dup keep-going? ]
[ rest-slice prune-redundant-predicates ]
}
[ [ first second ] [ rest-slice ] bi ]
} cond ;