Duck util-list.

This commit is contained in:
Dominik Pantůček 2023-07-05 21:58:34 +02:00
parent 1a2e9ee726
commit 2f1589579e
5 changed files with 34 additions and 21 deletions

View file

@ -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)