1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- (library (rnrs lists (6))
- (export find for-all exists filter partition fold-left fold-right remp remove
- remv remq memp member memv memq assp assoc assv assq cons*)
- (import (rnrs base (6))
- (only (guile) filter member memv memq assoc assv assq cons*)
- (rename (only (srfi srfi-1) any
- every
- remove
- member
- assoc
- find
- partition
- fold-right
- filter-map)
- (any exists)
- (every for-all)
- (remove remp)
-
- (member memp-internal)
- (assoc assp-internal)))
- (define (fold-left combine nil list . lists)
- (define (fold nil lists)
- (if (exists null? lists)
- nil
- (fold (apply combine nil (map car lists))
- (map cdr lists))))
- (fold nil (cons list lists)))
- (define (remove obj list) (remp (lambda (elt) (equal? obj elt)) list))
- (define (remv obj list) (remp (lambda (elt) (eqv? obj elt)) list))
- (define (remq obj list) (remp (lambda (elt) (eq? obj elt)) list))
- (define (memp pred list) (memp-internal #f list (lambda (x y) (pred y))))
- (define (assp pred list) (assp-internal #f list (lambda (x y) (pred y))))
- )
|