This shows you the differences between two versions of the page.

assignment-7 [2016/03/11 11:47] jhemann |
assignment-7 [2016/10/11 12:02] (current) jhemann |
||
---|---|---|---|

Line 105: | Line 105: | ||

- Replace your higher-order function representation of closures with a tagged-list data structure representation. Consider first ensuring that the last two formal parameters to ''apply-closure'' (''a'' and ''k'') are the same as the formal parameters to the inner function in ''make-closure''. | - Replace your higher-order function representation of closures with a tagged-list data structure representation. Consider first ensuring that the last two formal parameters to ''apply-closure'' (''a'' and ''k'') are the same as the formal parameters to the inner function in ''make-closure''. | ||

- Define constructors for your continuations, and replace your explicitly higher-order function continuations with calls to these constructors. For nested continuations, you should consider working from the inside out. Remember, if you transform your constructors one at a time, you can test your program after each replacement. | - Define constructors for your continuations, and replace your explicitly higher-order function continuations with calls to these constructors. For nested continuations, you should consider working from the inside out. Remember, if you transform your constructors one at a time, you can test your program after each replacement. | ||

- | - Add a ''^'' to each of the formal parameters of your continuation helpers, and change the body to match (that is, do an alpha substitution). Then, ensure that the inner function in each of your continuation helpers uses the same formal parameter as the second argument to ''apply-k'' (typically, ''v''). | + | - Add a ''^'' to each of the formal parameters of your continuation helpers, and change the body to correspond with these changed variable names (that is, do an alpha substitution). Then, ensure that the inner function in each of your continuation helpers uses the same formal parameter as the second argument to ''apply-k'' (typically, ''v''). |

- Replace your higher-order function representations of continuations with a tagged-list data structure representation. Remember, if you add ''(else (k v))'' as the last line of your match, you can test each transformation one at a time. If you're good, you can do almost all of this step with a keyboard macro. | - Replace your higher-order function representations of continuations with a tagged-list data structure representation. Remember, if you add ''(else (k v))'' as the last line of your match, you can test each transformation one at a time. If you're good, you can do almost all of this step with a keyboard macro. | ||

- Remove the ''(else (k v))'' line to ensure that you've properly removed all higher-order function representations of continuations. | - Remove the ''(else (k v))'' line to ensure that you've properly removed all higher-order function representations of continuations. |