HF RL Explorer

Implement a public function filter(pred, seq) that behaves like an extended version of Python's built-in…

Implement a public function filter(pred, seq) that behaves like an extended version of Python's built-in…: a task in repo2rlenv-r2e (Harbor dataset). The function must support the following pred types and behaviors: - None : keep elements that are truthy (same as built-in filter(None, seq) ). - A…

The task

The function must support the following `pred` types and behaviors: - `None`: keep elements that are truthy (same as built-in `filter(None, seq)`). - A callable: apply it directly to each element and keep those for which it returns truthy. - An `int` `i`: keep elements `e` for which `bool(e[i])` is `True` (i.e., use…

Part of FineEnvs/repo2rlenv-r2e.