<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -60,8 +60,8 @@
 ;;
 (define-syntax body-as-url
   (syntax-rules ()
-    ((_ (identifiers ...) body ...)
-     (closure-key-&gt;url (body-as-closure-key (identifiers ...) body ...)))))
+    ((_ (spec ...) body ...)
+     (closure-key-&gt;url (body-as-closure-key (spec ...) body ...)))))
 
 (define (closure-key-&gt;url clos-key)
   (format &quot;~A?~A=~A&quot;</diff>
      <filename>closures.scm</filename>
    </modified>
    <modified>
      <diff>@@ -167,6 +167,26 @@ When you define a session page, the session is automatically fetched for you (an
 
 @defproc[(session-put-val! (session session) (key symbol) (val any)) session]
 
+@subsection{Storing closures in URLs}
+
+LeftParen provides a simple way to create closures and attach them to a URL.  Using this technique is often much simpler than the more traditional encoding of values in a URL by hand.
+
+@defform[
+#:id body-as-url 
+(body-as-url (req-iden [key] [#:sticky]) body ...)
+]{Creates a URL which, when visited, will execute the given @scheme[body].  If @scheme[key] is provided, then it will be used as the id to represent the closure.  It's more common, however, to not pass your own key--in which case, a unique, random one will be chosen for you. @scheme[req-iden] will be bound to the request created when the link is executed and available for use in @scheme[body].  If @scheme[#:sticky] is provided, then the closure will be available for execution until the server is stopped.  Otherwise, it is available for execution just once.
+
+@schemeblock[
+(define-page (index-page req)
+  (let ((x 0))
+    (web-link &quot;Click to increment&quot;
+              (body-as-url (req)
+                           (set! x (+ x 1))
+                           (format &quot;x is ~A&quot; x)))))
+]
+
+This creates a link, which, when clicked, prints @tt{x is 1}.  If you reload the page, however, you'll see something like @tt{Expired or missing function 'q7c5ysd4935xhbhx2xbu'}.  Changing the first sub-form passed to @scheme[body-as-url] to @scheme[(req #:sticky)] makes it so that successive hits to the link result in increasing values of @scheme[x].
+}
 
 @subsection{Users}
 </diff>
      <filename>scribblings/leftparen.scrbl</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2a332f6de9b79d49d62de16e9e3033cf72638f7a</id>
    </parent>
  </parents>
  <author>
    <name>Rob Hunter</name>
    <email>rob.hunter@gmail.com</email>
  </author>
  <url>http://github.com/vegashacker/leftparen/commit/126f8489442bc52f3c990c913813a021fb6d9920</url>
  <id>126f8489442bc52f3c990c913813a021fb6d9920</id>
  <committed-date>2009-05-15T11:53:46-07:00</committed-date>
  <authored-date>2009-05-15T11:53:46-07:00</authored-date>
  <message>added some documentation on body-as-url</message>
  <tree>c7b50d9182a249aef59c9d9c96987e760beaf84b</tree>
  <committer>
    <name>Rob Hunter</name>
    <email>rob.hunter@gmail.com</email>
  </committer>
</commit>
