t3x.org / nss / remove.html

(Nils' Scheme Snippets)

 
Paren matching: ON  |  Category: lists  |  Overview  |  Scheme Books  |  License
 

(remove proc1 list) => list

 
Purpose
Remove elements from a list. The predicate p describes the property of the elements to be removed.
 
Arguments
p predicate
a source list
 
Dependencies
filter
Example
(remove number? '(a 1 b 2 c 3)) => (a b c)
(load "filter.scm")

(define (remove p a)
  (filter (lambda (x) (not (p x))) a))

Copyright (C) 2007 Nils M Holm <nmh @ t3x . org>