123456789101112131415161718192021222324252627 |
- (library (list-helpers)
- (export flatten
- make-list)
- (import
- (except (rnrs base) let-values map error)
- (only (guile)
- lambda* λ))
- (define flatten
- (λ (lst)
- (cond [(null? lst) '()]
- [(pair? lst)
- (append (flatten (car lst))
- (flatten (cdr lst)))]
- [else
- (list lst)])))
- (define make-list
- (λ (val count)
- (cond
- [(> count 0)
- (cons val (make-list val (- count 1)))]
- [else '()]))))
|