Permalink
Browse files

Doing general cleanup.

  • Loading branch information...
1 parent c671885 commit 19ccc012ef429a212a29929d6f56d220c02ef68c @cjfrisz committed Sep 13, 2012
Showing with 13 additions and 13 deletions.
  1. +3 −4 src/ctco/expr/app.clj
  2. +8 −7 src/ctco/expr/cont.clj
  3. +2 −2 src/ctco/expr/def.clj
View
@@ -3,7 +3,7 @@
;; Written by Chris Frisz
;;
;; Created 2 Apr 2012
-;; Last modified 2 Sep 2012
+;; Last modified 11 Sep 2012
;;
;; Defines the App record type for function application in the Clojure
;; TCO compiler.
@@ -90,6 +90,5 @@
proto/PWalkable
(walk-expr [this f _]
- (let [RATOR (f (:rator this))
- RAND* (vec (map f (:rand* this)))]
- (App. RATOR RAND*))))
+ (App. (f (:rator this))
+ (reduce #(conj %1 (f %2)) [] (:rand* this))))
View
@@ -3,7 +3,7 @@
;; Written by Chris Frisz
;;
;; Created 1 Apr 2012
-;; Last modified 2 Sep 2012
+;; Last modified 11 Sep 2012
;;
;; Defines the Cont, AppCont, and AppContAbs record types for
;; continuations, continuation application, and continuation
@@ -58,12 +58,6 @@
(abstract-k [this app-k]
(proto/walk-expr this #(proto/abstract-k % app-k) nil))
- proto/PAlphaRename
- (alpha-rename [this old new]
- (if (= (:arg this) old)
- this
- (proto/walk-expr this #(proto/alpha-rename % old new) nil)))
-
proto/PUnparse
(unparse [this]
`(fn [~(proto/unparse (:arg this))] ~(proto/unparse (:body this))))
@@ -116,5 +110,12 @@
cont-alpha-rename)
(extend-group (Cont AppContAbs AppCont)
+ ;; NB: One might argue that since we're using functions to represent
+ ;; NB: continuations, we should alpha-rename them as such. Both because this
+ ;; NB: representation is internal and is based on a gensym, we should have to
+ ;; NB: worry with it.
+ proto/PAlphaRename
+ cont-alpha-rename
+
proto/PThunkify
cont-thunkify)
View
@@ -3,7 +3,7 @@
;; Written by Chris
;;
;; Created 30 Aug 2012
-;; Last modified 3 Sep 2012
+;; Last modified 11 Sep 2012
;;
;; Defines the DefSrs, DefTriv, and DefCps record types for representing
;; 'def' expression in the Clojure TCO compiler.
@@ -59,7 +59,7 @@
(def def-walkable
{:walk-expr (fn [this f ctor]
- (ctor (f (:sym this)) (f (:init this))))})
+ (ctor (:sym this) (f (:init this))))})
(extend-group (DefCps DefSrs DefTriv)
proto/PUnparse

0 comments on commit 19ccc01

Please sign in to comment.