diff --git a/stdlib/stdlib.lsp b/stdlib/stdlib.lsp index 8d18806..7e6c66b 100644 --- a/stdlib/stdlib.lsp +++ b/stdlib/stdlib.lsp @@ -100,6 +100,20 @@ rslt )) +(defun flatten(lst) + (do + (define rslt '()) + (for e lst + (if (= (type e) "list") + (do + (for ee (flatten e) + (define rslt (push rslt ee)))) + (define rslt (push rslt e)) + )) + + rslt + )) + (defun quick-sort-by (l cmp) (if (<= (len l) 1) l