Created
October 24, 2012 20:48
-
-
Save edipofederle/3948779 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## From the book Clojure in Action | |
| ### A small program written in our fictitious XML-based language | |
| <program> | |
| <function name=addToStock> | |
| <param name=counter></param> | |
| <callFunction name=increment> | |
| <argument value=counter></argument> | |
| </callFunction> | |
| </function> | |
| <function name=removeFromStock> | |
| <param name=item></param> | |
| <callFunction name=decrementFromStockFile> | |
| <argument value=item></argument> | |
| </callFunction> | |
| </function> | |
| </program> | |
| to | |
| <function name=addToStock> | |
| <param name=counter></> | |
| <callFunction name=increment> | |
| <argument value=counter></> | |
| </> | |
| </> | |
| <function name=removeFromStock> | |
| <param name=item></> | |
| <callFunction name=decrementFromStockFile> | |
| <argument value=item></> | |
| </> | |
| </> | |
| to | |
| <function name=addToStock | |
| <param name=counter > | |
| <callFunction name=increment | |
| <argument value=counter > | |
| > | |
| > | |
| <function name=removeFromStock | |
| <param name=item > | |
| <callFunction name=decrementFromStockFile | |
| <argument value=item > | |
| > | |
| > | |
| to | |
| <define < addToStock counter > | |
| <increment counter > > | |
| <define < removeFromStock item > | |
| <decrementFromStockFile item > > | |
| to | |
| (define (addToStock counter) | |
| (increment counter)) | |
| (define (removeFromStock item) | |
| (decrementFromStockFile item)) | |
| Scheme :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment