frankshearar/zipr — Issue #21: select, reject
Author: frankshearar
Created: 2011-12-22 23:36:25+00:00
State: open

This requires #14, because otherwise we will move to an unpredictable point in the traversal. Otherwise, the idea's simple:

def select(&predicate)
map { |node|
@zipper.remove unless predicate.call(node)
}
end

def reject(&predicate)
select { |node|
not
end