list-helpers.scm 358 B

123456789101112131415161718
  1. (library (list-helpers)
  2. (export flatten)
  3. (import
  4. (except (rnrs base) let-values map error)
  5. (only (guile)
  6. lambda* λ))
  7. (define flatten
  8. (λ (lst)
  9. (cond [(null? lst) '()]
  10. [(pair? lst)
  11. (append (flatten (car lst))
  12. (flatten (cdr lst)))]
  13. [else
  14. (list lst)]))))