Hi, here's a small library I just made: https://github.com/kmatheussen/fedex2 With it, you can write code like this: (define-match keep [ ] ____ :> '[] [A . Rest] Pred :> (cons A (keep Rest Pred)) :where (Pred A) [_ . Rest] Pred :> (keep Rest Pred)) (define-match quicksort [] :> '[] [A . R] :> (append (quicksort (keep R (lambda (B) (>= A B)))) (list A) (quicksort (keep R (lambda (B) (< A B)))))) (test (quicksort '[6 8 5 9 3 2 2 1 4 7]) '[1 2 2 3 4 5 6 7 8 9])