import { identity } from "@thi.ng/compose/identity";
import { compR } from "./compr.js";
import { __iter } from "./iterator.js";
function keep(...args) {
  return __iter(keep, args) || ((rfn) => {
    const r = rfn[2];
    const pred = args[0] || identity;
    return compR(
      rfn,
      (acc, x) => pred(x) != null ? r(acc, x) : acc
    );
  });
}
export {
  keep
};
