Permalink
Browse files

Updating documentation and project version.

  • Loading branch information...
1 parent eab5789 commit 439f3a4ac2b19d2dfb87e7dd5c003d877f094d7e @cjfrisz committed Nov 5, 2012
Showing with 31 additions and 5 deletions.
  1. +29 −3 README.md
  2. +2 −2 project.clj
View
32 README.md
@@ -143,11 +143,37 @@ following code:
([n a k4583]
(if (zero? n)
(k4583 a)
- (with-meta
- #(fact (dec n) (* n a) k4583)
- {:thunk true})))))))
+ (recur (dec n) (* n a) k4583)))))))
```
+## Bonus: 'recurify' macro
+
+CTCO also provides a `recurify` macro which takes any expression
+accepted by the CTCO grammar and replaces all self-recursive tail
+calls that explicitly use a function name to instead use the `recur`
+form. It simply leverages the mechanism for doing the same
+transformation within the full CTCO transformation.
+
+For example:
+
+```clojure
+(recurify
+ (defn fact
+ [n a]
+ (if (zero? n)
+ a
+ (fact (dec n) (* n a)))))
+```
+
+This will expand to the following:
+
+```clojure
+(defn fact
+ [n a]
+ (if (zero? n)
+ a
+ (recur (dec n) (* n a))))
+```
## Contributing
View
4 project.clj
@@ -3,12 +3,12 @@
;; Written by Chris Frisz
;;
;; Created 4 Feb 2012
-;; Last modified 6 Oct 2012
+;; Last modified 5 Nov 2012
;;
;; Project declaration for clojure-tco.
;;----------------------------------------------------------------------
-(defproject ctco "0.4.2"
+(defproject ctco "0.5.0"
:description "Improving Clojure's support for constant-space tail calls."
:url "https://github.com/cjfrisz/clojure-tco"
:license {:name "The MIT License"

0 comments on commit 439f3a4

Please sign in to comment.