diff options
| author | azidar | 2015-04-13 17:51:00 -0700 |
|---|---|---|
| committer | azidar | 2015-04-13 17:51:00 -0700 |
| commit | c140b1ffbcf7fb5b2bb05e93388b2c79f2ddf9f9 (patch) | |
| tree | ea9621cbf742772c4f7c7bcf7ee09025402cb8d2 /src/main/stanza/ir-utils.stanza | |
| parent | e5e51130ebb109f9e433139cab098454da676b8f (diff) | |
Finished Infer Widths
Diffstat (limited to 'src/main/stanza/ir-utils.stanza')
| -rw-r--r-- | src/main/stanza/ir-utils.stanza | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/src/main/stanza/ir-utils.stanza b/src/main/stanza/ir-utils.stanza index 0bce0a90..a0379206 100644 --- a/src/main/stanza/ir-utils.stanza +++ b/src/main/stanza/ir-utils.stanza @@ -306,30 +306,31 @@ defmethod mapr (f: Width -> Width, s:Stmt) -> Stmt : ;================= HELPER FUNCTIONS USING MAP =================== -; These don't work properly.. -;public defmulti do (f:Expression -> ?, e:Expression) -> False -;defmethod do (f:Expression -> ?, e:Expression) -> False : -; for x in e map : -; f(x) -; x -; false -; -;public defmulti do (f:Expression -> ?, s:Stmt) -> False -;defmethod do (f:Expression -> ?, s:Stmt) -> False : -; defn f* (x:Expression) : -; f(x) -; x -; map(f*,s) -; false -; -;public defmulti do (f:Stmt -> ?, s:Stmt) -> False -;defmethod do (f:Stmt -> ?, s:Stmt) -> False : -; defn f* (x:Stmt) : -; f(x) -; x -; map(f*,s) -; false -; +public defmulti do (f:Expression -> ?, e:Expression) -> False +defmethod do (f:Expression -> ?, e:Expression) -> False : + defn f* (x:Expression) : + f(x) + x + map(f*,e) + false + +public defmulti do (f:Expression -> ?, s:Stmt) -> False +defmethod do (f:Expression -> ?, s:Stmt) -> False : + defn f* (x:Expression) : + f(x) + x + map(f*,s) + false + +public defmulti do (f:Stmt -> ?, s:Stmt) -> False +defmethod do (f:Stmt -> ?, s:Stmt) -> False : + defn f* (x:Stmt) : + f(x) + x + map(f*,s) + false + +; Not well defined - usually use dor on fields of a recursive type ;public defmulti dor (f:Expression -> ?, e:Expression) -> False ;defmethod dor (f:Expression -> ?, e:Expression) -> False : ; f(e) |
