From 542923a250c4553728a17c77ed81cd8064709609 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Sat, 2 Apr 2016 02:57:09 -0400 Subject: [PATCH] Use a foldr instead of apply --- TODO | 2 +- scheme/cyclone/transforms.sld | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index c4dbf694..b998dbd0 100644 --- a/TODO +++ b/TODO @@ -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 diff --git a/scheme/cyclone/transforms.sld b/scheme/cyclone/transforms.sld index 3bc2333c..9a59ec72 100644 --- a/scheme/cyclone/transforms.sld +++ b/scheme/cyclone/transforms.sld @@ -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)