src/Util/ListUtil/RemoveN.v
raw| 1 | From Coq Require Import List. |
| 2 | Import ListNotations. |
| 3 | Local Open Scope list_scope. |
| 4 | |
| 5 | Module List. |
| 6 | Section __. |
| 7 | Context {A} (f : A -> bool). |
| 8 | Fixpoint removen (l : list A) (n : nat) : list A |
| 9 | := match n, l with |
| 10 | | O, _ => l |
| 11 | | _, [] => [] |
| 12 | | S n', x :: xs => if f x then removen xs n' else x :: removen xs n |
| 13 | end. |
| 14 | End __. |
| 15 | End List. |