lib/srfi/srfi-1.scm: add append-map, filter, find.
This commit is contained in:
parent
a3e5461952
commit
da27cf183a
15
lib/srfi/srfi-1.scm
Normal file
15
lib/srfi/srfi-1.scm
Normal file
|
@ -0,0 +1,15 @@
|
|||
(define (find pred lst)
|
||||
(let loop ((lst lst))
|
||||
(if (null? lst) #f
|
||||
(if (pred (car lst)) (car lst)
|
||||
(loop (cdr lst))))))
|
||||
|
||||
(define (filter pred lst)
|
||||
(let loop ((lst lst))
|
||||
(if (null? lst) '()
|
||||
(if (pred (car lst))
|
||||
(cons (car lst) (loop (cdr lst)))
|
||||
(loop (cdr lst))))))
|
||||
|
||||
(define (append-map f lst)
|
||||
(apply append (map f lst)))
|
Loading…
Reference in a new issue