Duck util-list.
This commit is contained in:
parent
1a2e9ee726
commit
2f1589579e
5 changed files with 34 additions and 21 deletions
|
@ -25,8 +25,12 @@
|
|||
|
||||
(declare (unit util-list))
|
||||
|
||||
(module
|
||||
(import duck)
|
||||
|
||||
(module*
|
||||
util-list
|
||||
#:doc ("This module implements basic list functionality which is common in
|
||||
most scheme implementations.")
|
||||
(
|
||||
filter
|
||||
util-list-tests!
|
||||
|
@ -39,7 +43,12 @@
|
|||
testing)
|
||||
|
||||
;; Returns a list with elements matching pred? predicate.
|
||||
(define (filter pred? lst)
|
||||
(define/doc (filter pred? lst)
|
||||
("* ```pred?``` - procedure accepting any value and returning #t or #f
|
||||
* ```lst``` - list to be filtered
|
||||
|
||||
Returns a list containing only elements matching given ```pred?```
|
||||
predicate.")
|
||||
(let loop ((lst lst)
|
||||
(res '()))
|
||||
(if (null? lst)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue