diff --git a/src/ikarus.boot b/src/ikarus.boot index 1c93710..8205ef5 100644 Binary files a/src/ikarus.boot and b/src/ikarus.boot differ diff --git a/src/ikarus.lists.ss b/src/ikarus.lists.ss index 6f537c5..4e23508 100644 --- a/src/ikarus.lists.ss +++ b/src/ikarus.lists.ss @@ -2,13 +2,13 @@ (library (ikarus lists) (export $memq list? list cons* make-list append length list-ref reverse last-pair memq memp memv member assq assp assv assoc - remq remv remove remp map for-each andmap ormap list-tail) + remq remv remove remp filter map for-each andmap ormap list-tail) (import (ikarus system $fx) (ikarus system $pairs) (except (ikarus) list? list cons* make-list append reverse last-pair length list-ref memq memp memv member assq - assp assv assoc remq remv remove remp + assp assv assoc remq remv remove remp filter map for-each andmap ormap list-tail)) (define $memq @@ -391,7 +391,7 @@ (race x ls ls ls)))) - (module (remq remv remove remp) + (module (remq remv remove remp filter) (define-syntax define-remover (syntax-rules () [(_ name cmp check) @@ -432,7 +432,11 @@ (define-remover remp (lambda (elt p) (p elt)) (lambda (x ls) (unless (procedure? x) - (error 'remp "~s is not a procedure" x))))) + (error 'remp "~s is not a procedure" x)))) + (define-remover filter (lambda (elt p) (not (p elt))) + (lambda (x ls) + (unless (procedure? x) + (error 'filter "~s is not a procedure" x))))) (module (map) diff --git a/src/makefile.ss b/src/makefile.ss index be2cf84..4f46188 100755 --- a/src/makefile.ss +++ b/src/makefile.ss @@ -332,6 +332,7 @@ [remp i] [remv i] [remove i] + [filter i] [list-sort i] [vector-sort i] [vector-sort! i] diff --git a/src/todo-r6rs.ss b/src/todo-r6rs.ss index 63caf1f..f7fc248 100755 --- a/src/todo-r6rs.ss +++ b/src/todo-r6rs.ss @@ -504,7 +504,7 @@ [assq C ls se] [assv C ls se] [cons* C ls] - [filter S ls] + [filter C ls] [find S ls] [fold-left S ls] [fold-right S ls] @@ -516,9 +516,9 @@ [memv C ls se] [partition S ls] [remq C ls] - [remp S ls] - [remv S ls] - [remove S ls] + [remp C ls] + [remv C ls] + [remove C ls] ;;; [set-car! C mp se] [set-cdr! C mp se] @@ -792,12 +792,6 @@ libs)))) (error #f "invalid id ~s" x))) -(define (filter p? ls) - (cond - [(null? ls) '()] - [(p? (car ls)) - (cons (car ls) (filter p? (cdr ls)))] - [else (filter p? (cdr ls))])) (define (filter* ls) (filter