Use a foldr instead of apply

This commit is contained in:
Justin Ethier 2016-04-02 02:57:09 -04:00
parent 949aef875f
commit 542923a250
2 changed files with 7 additions and 3 deletions

2
TODO
View file

@ -47,7 +47,7 @@ Tier 1:
- puzzle.scm
- quicksort.scm
- ray.scm - Error: Unable to open file outputs/ray.output. similar issue to above?
- read0.scm - Error (line 170, char 25): unable to parse character: x3bb
- read0.scm - needs open-input-string
- read1.scm
- sboyer.scm
- scheme.scm - Problem with (macro?) being a primitive and defined in application code

View file

@ -981,8 +981,12 @@
;; TODO: remove unused locals
(define (filter-unused-variables asts lib-exports)
(define (do-filter code)
(let ((all-fv (apply ;; More efficient way to do this?
append ;; Could use delete-duplicates
(let ((all-fv ;(apply ;; More efficient way to do this?
; append ;; Could use delete-duplicates
(foldr
(lambda (l ls)
(append ls l))
'()
(map
(lambda (ast)
(if (define? ast)