Cleanup old comments and fnc names

This commit is contained in:
Justin Ethier 2019-02-08 13:06:05 -05:00
parent a0a9242d64
commit 407a0c0581

View file

@ -22,7 +22,9 @@
) )
)) ))
;; TODO: function to actually scan a def to see if that def can be memoized ;; Predicate to determine if a function can be memoized
;; var - symbol - global name of the function
;; body - lambda ast - Function object
(define (memoizable? var body) (define (memoizable? var body)
(define cont #f) (define cont #f)
(define (scan exp return locals) (define (scan exp return locals)
@ -110,7 +112,8 @@
(else #f)) (else #f))
) )
(define (analyze:memoize-pure-fncs sexp) ;; Transformation to memoize simple recursive numeric functions
(define (opt:memoize-pure-fncs sexp)
(define memo-tbl '()) (define memo-tbl '())
;; exp - S-expression to scan ;; exp - S-expression to scan
@ -125,8 +128,6 @@
((ref? exp) exp) ((ref? exp) exp)
((define? exp) ((define? exp)
;; TODO: support non-top-level defines in the future as well ;; TODO: support non-top-level defines in the future as well
;; TODO: is this a candidate function? if so, scan it using (memoizable?)
(let ((var (define->var exp)) (let ((var (define->var exp))
(body (car (define->exp exp)))) (body (car (define->exp exp))))
(cond (cond
@ -325,7 +326,7 @@
;(analyze:find-recursive-calls ast) ;(analyze:find-recursive-calls ast)
(pretty-print (pretty-print
(ast:ast->pp-sexp (ast:ast->pp-sexp
(analyze:memoize-pure-fncs ast)))) (opt:memoize-pure-fncs ast))))
;; (pretty-print ;; (pretty-print
;; (ast:ast->pp-sexp ;; (ast:ast->pp-sexp