27 lines
854 B
Scheme
27 lines
854 B
Scheme
#|
|
|
This file is part of Ordo.
|
|
|
|
Copyright (C) 2025 Ray Miller
|
|
|
|
This program is free software: you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
Foundation, version 3.
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|#
|
|
|
|
(define-module (ordo util flatten)
|
|
#:export (flatten))
|
|
|
|
(define (flatten lst)
|
|
(cond
|
|
((null? lst) '())
|
|
((list? (car lst))
|
|
(append (flatten (car lst)) (flatten (cdr lst))))
|
|
(else
|
|
(cons (car lst) (flatten (cdr lst))))))
|