Fix flat-map
authorLuke Lau <luke_lau@icloud.com>
Sun, 4 Aug 2019 18:09:40 +0000 (19:09 +0100)
committerLuke Lau <luke_lau@icloud.com>
Sun, 4 Aug 2019 18:09:40 +0000 (19:09 +0100)
ast.scm

diff --git a/ast.scm b/ast.scm
index 23e7723cc725a3a07b2fe5229576b92e604c34b2..1a4afe21f3258d829c4f305ea78fd2f804cca2ad 100644 (file)
--- a/ast.scm
+++ b/ast.scm
       (append (range s (- n 1))
              (list (+ s (- n 1))))))
 
-(define (flat-map f . xs) (fold-left append '() (map f xs)))
+(define (flat-map f . xs) (fold-left append '() (apply map (cons f xs))))
 (define (repeat x n) (if (<= n 0) '()
                         (cons x (repeat x (- n 1)))))