public EObject select() {
int count = 0;
ESeq vals = ERT.NIL;
ISeq map_seq = map_ent;
ISeq coll_seq = coll_ent;
while ((seq_has_more(map_seq) || seq_has_more(coll_seq)) && (limit < 0 || count < limit)) {
if (!seq_has_more(coll_seq)) {
IMapEntry ent = (IMapEntry) map_seq.first();
IPersistentCollection coll = (IPersistentCollection) ent.getValue();
coll_seq = coll.seq();
map_seq = map_seq.next();
}
assert seq_has_more(coll_seq);
ETuple candidate = (ETuple) coll_seq.first();
coll_seq = coll_seq.next();
EObject res;
if ((res = matcher.match(candidate)) != null) {
count += 1;
vals = vals.cons(res);