>From 15ed53550163a652d02b71eb1145db2da83f75a2 Mon Sep 17 00:00:00 2001
From: dvanhorn <dvanhorn@ccs.neu.edu>
Date: Tue, 25 May 2010 20:24:21 -0400
Subject: [PATCH] Added remf to unstable/list.

---
 collects/tests/unstable/list.rkt         |    9 +++++++++
 collects/unstable/list.rkt               |   10 ++++++++++
 collects/unstable/scribblings/list.scrbl |   15 +++++++++++++++
 3 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 collects/tests/unstable/list.rkt

diff --git a/collects/tests/unstable/list.rkt b/collects/tests/unstable/list.rkt
new file mode 100644
index 0000000..fedd410
--- /dev/null
+++ b/collects/tests/unstable/list.rkt
@@ -0,0 +1,9 @@
+#lang scheme
+(require unstable/list)
+(require tests/eli-tester)
+(test
+ (remf positive? '()) => '()
+ (remf positive? '(1 -2 3 4 -5)) => '(-2 3 4 -5)
+ (remf even? '(1 -2 3 4 -5)) => '(1 3 4 -5)
+ (remf (λ (x) #f) '(1 -2 3 4 -5)) => '(1 -2 3 4 -5))
+
diff --git a/collects/unstable/list.rkt b/collects/unstable/list.rkt
index ab35a6f..f8b964d 100644
--- a/collects/unstable/list.rkt
+++ b/collects/unstable/list.rkt
@@ -112,3 +112,13 @@
 
 (provide map/values)
 
+;; dvanhorn added:
+
+(define (remf f ls)
+  (cond [(null? ls) '()]
+        [(f (car ls)) (cdr ls)]
+        [else 
+         (cons (car ls)
+               (remf f (cdr ls)))]))
+
+(provide/contract [remf (-> procedure? list? list?)])
diff --git a/collects/unstable/scribblings/list.scrbl b/collects/unstable/scribblings/list.scrbl
index 76509f6..3bc0a26 100644
--- a/collects/unstable/scribblings/list.scrbl
+++ b/collects/unstable/scribblings/list.scrbl
@@ -103,3 +103,18 @@ Produces lists of the respective values of @racket[f] applied to the elements in
 
 }
 
+@addition{David Van Horn}
+
+@defproc[(remf [pred procedure?]
+               [lst list?])
+         list?]{
+Returns a list that is like @racket[lst], omitting the first element of @racket[lst] 
+for which @racket[pred] produces a true value.
+
+@defexamples[
+#:eval the-eval
+(remf negative? '(1 -2 3 4 -5))
+]
+
+}
+
-- 
1.7.1

