Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 169c896bda
Fetching contributors…

Cannot retrieve contributors at this time

4 lines (4 sloc) 72.365 kB
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text-html; charset=utf-8" /><title>LeftParen 0.61 Documentation</title><link rel="stylesheet" type="text/css" href="scribble.css" title="default" /><script type="text/javascript" src="scribble-common.js"></script></head><body id="scribble-plt-scheme-org"><div class="tocset"><div class="tocview"><div class="tocviewlist" style="margin-bottom: 1em;"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,&quot;tocview_0&quot;);">&#9658;</a></td><td></td><td><a href="/" class="tocviewselflink">Left<span class="mywbr"> </span>Paren 0.61 Documentation</a></td></tr></table></div><div class="tocviewsublistonly" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="/#(part._.Installing_.Left.Paren)" class="tocviewlink">Installing Left<span class="mywbr"> </span>Paren</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="/#(part._tutorials)" class="tocviewlink">Tutorials</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="/#(part._.Reference)" class="tocviewlink">Reference</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="/#(part._utilities)" class="tocviewlink">Utility Functions</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="/#(part._.About_.Acknowledgements)" class="tocviewlink">About/<span class="mywbr"> </span>Acknowledgements</a></td></tr></table></div></div></div><div class="tocsub"><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">1<tt>&nbsp;</tt></span><a href="#(part._.Installing_.Left.Paren)" class="tocsubseclink">Installing Left<span class="mywbr"> </span>Paren</a></td></tr><tr><td><span class="tocsublinknumber">2<tt>&nbsp;</tt></span><a href="#(part._tutorials)" class="tocsubseclink">Tutorials</a></td></tr><tr><td><span class="tocsublinknumber">2.1<tt>&nbsp;</tt></span><a href="#(part._.Hello__.World)" class="tocsubseclink">Hello, World</a></td></tr><tr><td><span class="tocsublinknumber">2.2<tt>&nbsp;</tt></span><a href="#(part._.Blogerton_the_.Blog)" class="tocsubseclink">Blogerton the Blog</a></td></tr><tr><td><span class="tocsublinknumber">2.2.1<tt>&nbsp;</tt></span><a href="#(part._.Changes_to_app_scm)" class="tocsubseclink">Changes to <span class="stt">app.scm</span></a></td></tr><tr><td><span class="tocsublinknumber">2.2.2<tt>&nbsp;</tt></span><a href="#(part._.Changes_to_main_scm)" class="tocsubseclink">Changes to <span class="stt">main.scm</span></a></td></tr><tr><td><span class="tocsublinknumber">2.2.3<tt>&nbsp;</tt></span><a href="#(part._.Launch_.Blogerton)" class="tocsubseclink">Launch Blogerton</a></td></tr><tr><td><span class="tocsublinknumber">3<tt>&nbsp;</tt></span><a href="#(part._.Reference)" class="tocsubseclink">Reference</a></td></tr><tr><td><span class="tocsublinknumber">3.1<tt>&nbsp;</tt></span><a href="#(part._.Forms)" class="tocsubseclink">Forms</a></td></tr><tr><td><span class="tocsublinknumber">3.1.1<tt>&nbsp;</tt></span><a href="#(part._.Image_uploads)" class="tocsubseclink">Image uploads</a></td></tr><tr><td><span class="tocsublinknumber">3.2<tt>&nbsp;</tt></span><a href="#(part._.Sessions)" class="tocsubseclink">Sessions</a></td></tr><tr><td><span class="tocsublinknumber">3.2.1<tt>&nbsp;</tt></span><a href="#(part._.Creating_sessions)" class="tocsubseclink">Creating sessions</a></td></tr><tr><td><span class="tocsublinknumber">3.2.2<tt>&nbsp;</tt></span><a href="#(part._.Accessing_sessions)" class="tocsubseclink">Accessing sessions</a></td></tr><tr><td><span class="tocsublinknumber">3.3<tt>&nbsp;</tt></span><a href="#(part._.Storing_closures_in_.U.R.Ls)" class="tocsubseclink">Storing closures in URLs</a></td></tr><tr><td><span class="tocsublinknumber">3.4<tt>&nbsp;</tt></span><a href="#(part._.Users)" class="tocsubseclink">Users</a></td></tr><tr><td><span class="tocsublinknumber">3.5<tt>&nbsp;</tt></span><a href="#(part._.Feeds)" class="tocsubseclink">Feeds</a></td></tr><tr><td><span class="tocsublinknumber">4<tt>&nbsp;</tt></span><a href="#(part._utilities)" class="tocsubseclink">Utility Functions</a></td></tr><tr><td><span class="tocsublinknumber">5<tt>&nbsp;</tt></span><a href="#(part._.About_.Acknowledgements)" class="tocsubseclink">About/<span class="mywbr"> </span>Acknowledgements</a></td></tr><tr><td><span class="tocsublinknumber">5.1<tt>&nbsp;</tt></span><a href="#(part._.Code_.Contributors)" class="tocsubseclink">Code Contributors</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="versionbox"><span class="version">Version: 4.1.5</span></div><h2><a name="(part._.Left.Paren_0_61_.Documentation)"></a>LeftParen 0.61 Documentation</h2><p>Website: <a href="http://leftparen.com">http://leftparen.com</a></p><p>LeftParen is a framework for quickly creating web apps. It runs on
PLT Scheme v4.1.5. LeftParen is released under an <a href="http://github.com/vegashacker/leftparen/tree/master/MIT-LICENSE.txt">MIT License</a>. The source is available on <a href="http://github.com/vegashacker/leftparen/tree/master">github</a>.</p><h3>1<tt>&nbsp;</tt><a name="(part._.Installing_.Left.Paren)"></a>Installing LeftParen</h3><p>You&rsquo;ll need PLT Scheme v4.1.5 installed. More recent versions may work, but they are untested.</p><p>Make sure that <span class="schemesymbol">mzscheme</span> is in your path. You should be ready
to go if you can do this:</p><p><table cellspacing="0"><tr><td><span class="stt"><span class="stt">% mzscheme</span></span></td></tr><tr><td><span class="stt"><span class="stt">Welcome to MzScheme v4.1.5...</span></span></td></tr><tr><td><span class="stt"><span class="stt">&gt;</span></span></td></tr></table></p><p>Installing LeftParen is done automatically when you perform various <a href="http://planet.plt-scheme.org/">PLaneT</a> <span class="schemesymbol">require</span> commands. See <a href="/#(part._tutorials)">Tutorials</a> for examples of this. On my system, starting a LeftParen web app for the first time (with a freshly installed version of PLT Scheme), takes about an hour. (The time is spent downloading and installing a bunch of files into your local PLaneT repository.)</p><p>At any point, if you see an error like</p><p><table cellspacing="0"><tr><td><span class="stt"><span class="stt">make-directory: cannot make directory: /home/rob/.plt-scheme/planet/300/4.1.5 (Permission denied; errno=13)</span></span></td></tr></table></p><p>try re-running the command with <span class="stt">sudo</span> (you won&rsquo;t need to do this everytime&ndash;just the once).</p><h3>2<tt>&nbsp;</tt><a name="(part._tutorials)"></a>Tutorials</h3><h4>2.1<tt>&nbsp;</tt><a name="(part._.Hello__.World)"></a>Hello, World</h4><p>We&rsquo;re going to make a project called <span class="stt">hello-world</span>. Change to the directory that you&rsquo;d like to create the project in. Then issue</p><p><table cellspacing="0"><tr><td><span class="stt"><span class="stt">% mzscheme -e '(require (planet vegashacker/leftparen:5:=1/generate))' hello-world</span></span></td></tr></table></p><p>This will create a <span class="stt">hello-world</span> project directory for you. In this directory you&rsquo;ll find the <span class="stt">script</span> directory, which contains some useful scripts. All paths are relative to this project directory, so when calling scripts, you always want to be at the project root.</p><p><table cellspacing="0"><tr><td><span class="stt"><span class="stt">% cd hello-world</span></span></td></tr></table></p><p>We need to make the scripts executable:</p><p><table cellspacing="0"><tr><td><span class="stt"><span class="stt">% chmod u+x script/server</span></span></td></tr></table></p><p>LeftParen has automatically generated everything we need to run our web app &ndash; we just need to start the server (again, you should be at the project root directory):</p><p><table cellspacing="0"><tr><td><span class="stt"><span class="stt">% ./script/server</span></span></td></tr><tr><td><span class="stt"><span class="stt">Populating caches...</span></span></td></tr><tr><td><span class="stt"><span class="stt">Done populating cache.</span></span></td></tr><tr><td><span class="stt"><span class="stt">Server is ready at http://localhost:8765/ (ctrl-c to stop it).</span></span></td></tr></table></p><p>Point your browser to <a href="http://localhost:8765">http://localhost:8765</a> and you should see a familiar greeting:</p><p><span class="stt">Hello, World!</span></p><h4>2.2<tt>&nbsp;</tt><a name="(part._.Blogerton_the_.Blog)"></a>Blogerton the Blog</h4><p>Now let&rsquo;s try implementing the true "hello world" of web apps &ndash; a blog. First, execute the following commands from the directory in which you want to create your project:</p><p><table cellspacing="0"><tr><td><span class="stt"><span class="stt">% mzscheme -e '(require (planet vegashacker/leftparen:5:=1/generate))' blogerton</span></span></td></tr><tr><td><span class="stt"><span class="stt">% cd blogerton</span></span></td></tr><tr><td><span class="stt"><span class="stt">% chmod u+x script/server</span></span></td></tr></table></p><h5>2.2.1<tt>&nbsp;</tt><a name="(part._.Changes_to_app_scm)"></a>Changes to <span class="stt">app.scm</span></h5><p>We need to register a couple of pages in our app. The <span class="schemesymbol">index-page</span> was already set up for you, but you&rsquo;ll need to add a page to create new posts, and one to view them. Make the <span class="schemesymbol">define-app</span> call look like this:</p><p><table cellspacing="0" class="schemeblock"><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">define-app</span><span class="hspace">&nbsp;</span><span class="schemesymbol">my-app</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">index-page</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">url</span><span class="hspace">&nbsp;</span><span class="schemevalue">"/"</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">create-post-page</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">url</span><span class="hspace">&nbsp;</span><span class="schemevalue">"/post"</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">view-post-page</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">url</span><span class="hspace">&nbsp;</span><span class="schemevalue">"/view/"</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">string-arg</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr></table></p><h5>2.2.2<tt>&nbsp;</tt><a name="(part._.Changes_to_main_scm)"></a>Changes to <span class="stt">main.scm</span></h5><p>Now we need to define those pages that we declared in <span class="stt">app.scm</span>.</p><p><table cellspacing="0" class="schemeblock"><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">define-page</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">index-page</span><span class="hspace">&nbsp;</span><span class="schemesymbol">req</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">**</span><span class="hspace">&nbsp;</span><span class="schemevalue">`</span><span class="schemevalue">(</span><span class="schemevalue">h1</span><span class="hspace">&nbsp;</span><span class="schemevalue">"Blogerton"</span><span class="schemevalue">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemevalue">`</span><span class="schemevalue">(</span><span class="schemevalue">p</span><span class="hspace">&nbsp;</span><span class="schemereader">,</span><span class="schemeparen">(</span><span class="schemesymbol">web-link</span><span class="hspace">&nbsp;</span><span class="schemevalue">"Create a new post"</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">page-url</span><span class="hspace">&nbsp;</span><span class="schemesymbol">create-post-page</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemevalue">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemevalue">`</span><span class="schemevalue">(</span><span class="schemevalue">ul</span><span class="hspace">&nbsp;</span><span class="schemereader">,@</span><span class="schemeparen">(</span><span class="schemesymbol">map</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">lambda</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">p</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span><span class="schemevalue">`</span><span class="schemevalue">(</span><span class="schemevalue">li</span><span class="hspace">&nbsp;</span><span class="schemereader">,</span><span class="schemeparen">(</span><span class="schemesymbol">paint-blog-post</span><span class="hspace">&nbsp;</span><span class="schemesymbol">p</span><span class="schemeparen">)</span><span class="schemevalue">)</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">load-where</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">(</span><span class="schemevalue">(</span><span class="schemevalue">type</span><span class="hspace">&nbsp;</span><span class="schemevalue">. </span><span class="schemevalue">blog-post</span><span class="schemevalue">)</span><span class="schemevalue">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:sort-by</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">created-at</span><span class="hspace">&nbsp;</span><span class="schemeparen">#:compare</span><span class="hspace">&nbsp;</span><span class="schemesymbol">&gt;</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemevalue">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="schemeparen">(</span><span class="schemesymbol">define-page</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">create-post-page</span><span class="hspace">&nbsp;</span><span class="schemesymbol">req</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">form</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">(</span><span class="schemevalue">(</span><span class="schemevalue">title</span><span class="hspace">&nbsp;</span><span class="schemevalue">"Title"</span><span class="hspace">&nbsp;</span><span class="schemevalue">text</span><span class="schemevalue">)</span><span class="hspace">&nbsp;</span><span class="schemevalue">(</span><span class="schemevalue">body</span><span class="hspace">&nbsp;</span><span class="schemevalue">"Body"</span><span class="hspace">&nbsp;</span><span class="schemevalue">long-text</span><span class="schemevalue">)</span><span class="schemevalue">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:init</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">(</span><span class="schemevalue">(</span><span class="schemevalue">type</span><span class="hspace">&nbsp;</span><span class="schemevalue">. </span><span class="schemevalue">blog-post</span><span class="schemevalue">)</span><span class="schemevalue">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:on-done</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">lambda</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">post</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">redirect-to-page</span><span class="hspace">&nbsp;</span><span class="schemesymbol">view-post-page</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">rec-id</span><span class="hspace">&nbsp;</span><span class="schemesymbol">post</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="schemeparen">(</span><span class="schemesymbol">define-page</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">view-post-page</span><span class="hspace">&nbsp;</span><span class="schemesymbol">req</span><span class="hspace">&nbsp;</span><span class="schemesymbol">post-id</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">paint-blog-post</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">load-rec</span><span class="hspace">&nbsp;</span><span class="schemesymbol">post-id</span><span class="hspace">&nbsp;</span><span class="schemeparen">#:ensure</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">(</span><span class="schemevalue">(</span><span class="schemevalue">type</span><span class="hspace">&nbsp;</span><span class="schemevalue">. </span><span class="schemevalue">blog-post</span><span class="schemevalue">)</span><span class="schemevalue">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="schemeparen">(</span><span class="schemesymbol">define</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">paint-blog-post</span><span class="hspace">&nbsp;</span><span class="schemesymbol">post</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="schemevalue">`</span><span class="schemevalue">(</span><span class="schemevalue">div</span><span class="hspace">&nbsp;</span><span class="schemevalue">(</span><span class="schemevalue">h2</span><span class="hspace">&nbsp;</span><span class="schemereader">,</span><span class="schemeparen">(</span><span class="schemesymbol">rec-prop</span><span class="hspace">&nbsp;</span><span class="schemesymbol">post</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">title</span><span class="schemeparen">)</span><span class="schemevalue">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemevalue">(</span><span class="schemevalue">p</span><span class="hspace">&nbsp;</span><span class="schemereader">,</span><span class="schemeparen">(</span><span class="schemesymbol">rec-prop</span><span class="hspace">&nbsp;</span><span class="schemesymbol">post</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">body</span><span class="schemeparen">)</span><span class="schemevalue">)</span><span class="schemevalue">)</span><span class="schemeparen">)</span></td></tr></table></p><h5>2.2.3<tt>&nbsp;</tt><a name="(part._.Launch_.Blogerton)"></a>Launch Blogerton</h5><p>You&rsquo;re ready for launch. Start the server with</p><p><table cellspacing="0"><tr><td><span class="stt"><span class="stt">% ./script/server</span></span></td></tr></table></p><p>and you should have a basic blogging app, with persistent data, in 19 lines of code.</p><h3>3<tt>&nbsp;</tt><a name="(part._.Reference)"></a>Reference</h3><h4>3.1<tt>&nbsp;</tt><a name="(part._.Forms)"></a>Forms</h4><p>Most web applications make some use of web forms. The <span class="schemesymbol">form</span> function lets easily you get and process input from your users.</p><p><table cellspacing="0" class="boxed"><tr><td><span class="schemeparen">(</span><span class="schemesymbol">form</span><span class="hspace">&nbsp;</span><span class="schemevariable">field-specs</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="schemesymbol">xexpr?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">field-specs</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">listof</span><span class="hspace">&nbsp;</span><span class="schemesymbol">field-spec?</span><span class="schemeparen">)</span></td></tr></table></p><p><table cellspacing="0" class="boxed"><tr><td><span class="schemesymbol">field-spec?</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">list</span><span class="hspace">&nbsp;</span><span class="schemesymbol">symbol?</span><span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span><span class="hspace">&nbsp;</span><span class="schemesymbol">field-type?</span><span class="schemeparen">)</span></td></tr></table></p><p><table cellspacing="0" class="boxed"><tr><td><table cellspacing="0" class="argcontract"><tr><td><span class="schemesymbol">field-type?</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span></td><td><table cellspacing="0" class="schemeblock"><tr><td><span class="schemeparen">(</span><span class="schemesymbol">or/c</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">text</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">long-text</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">number</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">password</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">image</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">checkbox</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">radio</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">drop-down</span><span class="schemeparen">)</span></td></tr></table></td></tr></table></td></tr></table></p><p>You create a form by listing, in order, "field specifications". For example, you might want a title field, followed by a description text box, followed by a photo upload field. Note that the many keyword arguments available to the <span class="schemesymbol">form</span> function aren&rsquo;t documented yet.</p><p>Each field spec is of the form <span class="schemeparen">(</span><span class="schemesymbol">field-name</span><span class="stt"> </span><span class="schemesymbol">label</span><span class="stt"> </span><span class="schemesymbol">field-type</span><span class="schemeparen">)</span>. For example, you create a title field, you might use the spec <span class="schemeparen">(</span><span class="schemesymbol">title</span><span class="stt"> </span><span class="schemevalue">"Enter a title"</span><span class="stt"> </span><span class="schemesymbol">text</span><span class="schemeparen">)</span>. The entire example metioned above might look like this:</p><p><table cellspacing="0" class="schemeblock"><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">form</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">(</span><span class="schemevalue">(</span><span class="schemevalue">title</span><span class="hspace">&nbsp;</span><span class="schemevalue">"Title"</span><span class="hspace">&nbsp;</span><span class="schemevalue">text</span><span class="schemevalue">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemevalue">(</span><span class="schemevalue">description</span><span class="hspace">&nbsp;</span><span class="schemevalue">"Description"</span><span class="hspace">&nbsp;</span><span class="schemevalue">long-text</span><span class="schemevalue">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemevalue">(</span><span class="schemevalue">photo</span><span class="hspace">&nbsp;</span><span class="schemevalue">"Your photo"</span><span class="hspace">&nbsp;</span><span class="schemevalue">image</span><span class="schemevalue">)</span><span class="schemevalue">)</span><span class="schemeparen">)</span></td></tr></table></p><h5>3.1.1<tt>&nbsp;</tt><a name="(part._.Image_uploads)"></a>Image uploads</h5><p>By default, uploaded images are stored in the <span class="stt">uploaded-files</span> directory in your project directory. You can customize this with the <span class="schemesymbol">*PATH_TO_UPLOADED_FILES*</span> setting. When images are saved, their original filenames are used with a 5-character code pre-pended to make filenames unique.</p><h4>3.2<tt>&nbsp;</tt><a name="(part._.Sessions)"></a>Sessions</h4><p>A session is an object that allows you to easily store state about individual visitors to your web app. Sessions are stored on the server as a record with a virtually impossible-to-guess id. A cookie is left in the user&rsquo;s web browser, which contains a pointer to a particular session id. These cookies expire one month after creation and, currently, this can&rsquo;t be changed.</p><h5>3.2.1<tt>&nbsp;</tt><a name="(part._.Creating_sessions)"></a>Creating sessions</h5><p><table cellspacing="0" class="boxed"><tr><td><table cellspacing="0" class="schemeblock"><tr><td><span class="schemeparen">(</span><span class="schemesymbol">define-session-page</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemevariable">page-name</span><span class="hspace">&nbsp;</span><span class="schemevariable">request-iden</span><span class="hspace">&nbsp;</span><span class="schemevariable">session-iden</span><span class="hspace">&nbsp;</span><span class="schemevariable">page-args</span><span class="hspace">&nbsp;</span><span class="schememeta">...</span><span class="schemeparen">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">body</span><span class="hspace">&nbsp;</span><span class="schememeta">...</span><span class="schemeparen">)</span></td></tr></table></td></tr></table></p><p>This is an alternate to <span class="schemesymbol">define-page</span>, most commonly used in <span class="schemesymbol">main.scm</span>. The only difference is that after the request identifier, you must provide a session identifier. For example, to keep a counter (unique to each user), you could write:</p><p><table cellspacing="0" class="schemeblock"><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">define-session-page</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">foo-page</span><span class="hspace">&nbsp;</span><span class="schemesymbol">req</span><span class="hspace">&nbsp;</span><span class="schemesymbol">sesh</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">let</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemeparen">(</span><span class="schemesymbol">c</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">session-get-val</span><span class="hspace">&nbsp;</span><span class="schemesymbol">sesh</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">counter</span><span class="hspace">&nbsp;</span><span class="schemevalue">0</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">session-put-val!</span><span class="hspace">&nbsp;</span><span class="schemesymbol">sesh</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">counter</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">+</span><span class="hspace">&nbsp;</span><span class="schemevalue">1</span><span class="hspace">&nbsp;</span><span class="schemesymbol">c</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">number-&gt;string</span><span class="hspace">&nbsp;</span><span class="schemesymbol">c</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr></table></p><p>When you define a session page, the session is automatically fetched for you (and created if necessary), and bound to the session identifier you provided.</p><h5>3.2.2<tt>&nbsp;</tt><a name="(part._.Accessing_sessions)"></a>Accessing sessions</h5><p><table cellspacing="0" class="boxed"><tr><td><span class="schemeparen">(</span><span class="schemesymbol">session-get-val</span><span class="hspace">&nbsp;</span><span class="schemevariable">session</span><span class="hspace">&nbsp;</span><span class="schemevariable">key</span><span class="hspace">&nbsp;</span>[<span class="schemevariable">missing-val</span>]<span class="schemeparen">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="schemesymbol">any</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">session</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemevariable">session</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">key</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">symbol</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">missing-val</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">any</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="schemevalue">#f</span></td></tr></table></p><p><table cellspacing="0" class="boxed"><tr><td><span class="schemeparen">(</span><span class="schemesymbol">session-put-val!</span><span class="hspace">&nbsp;</span><span class="schemevariable">session</span><span class="hspace">&nbsp;</span><span class="schemevariable">key</span><span class="hspace">&nbsp;</span><span class="schemevariable">val</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="schemevariable">session</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">session</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemevariable">session</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">key</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">symbol</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">val</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">any</span></td></tr></table></p><h4>3.3<tt>&nbsp;</tt><a name="(part._.Storing_closures_in_.U.R.Ls)"></a>Storing closures in URLs</h4><p>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.</p><p><table cellspacing="0" class="boxed"><tr><td><span class="schemeparen">(</span><span class="schemesymbol">body-as-url</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemevariable">req-iden</span><span class="hspace">&nbsp;</span><span class="schemeparen">[</span><span class="schemevariable">key</span><span class="schemeparen">]</span><span class="hspace">&nbsp;</span><span class="schemeparen">[</span><span class="schemeparen">#:sticky</span><span class="schemeparen">]</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span><span class="schemevariable">body</span><span class="hspace">&nbsp;</span><span class="schememeta">...</span><span class="schemeparen">)</span></td></tr></table></p><p>Creates a URL which, when visited, will execute the given <span class="schemevariable">body</span>. If <span class="schemevariable">key</span> is provided, then it will be used as the id to represent the closure. It&rsquo;s more common, however, to not pass your own key&ndash;in which case, a unique, random one will be chosen for you. <span class="schemevariable">req-iden</span> will be bound to the request created when the link is executed and available for use in <span class="schemevariable">body</span>. If <span class="schemeparen">#:sticky</span> is provided, then the closure will be available for execution until the server is stopped. Otherwise, it is available for execution just once.</p><p><table cellspacing="0" class="schemeblock"><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">define-page</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">index-page</span><span class="hspace">&nbsp;</span><span class="schemesymbol">req</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">let</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemeparen">(</span><span class="schemesymbol">x</span><span class="hspace">&nbsp;</span><span class="schemevalue">0</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">web-link</span><span class="hspace">&nbsp;</span><span class="schemevalue">"Click to increment"</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">body-as-url</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">req</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">set!</span><span class="hspace">&nbsp;</span><span class="schemesymbol">x</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">+</span><span class="hspace">&nbsp;</span><span class="schemesymbol">x</span><span class="hspace">&nbsp;</span><span class="schemevalue">1</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">format</span><span class="hspace">&nbsp;</span><span class="schemevalue">"x is ~A"</span><span class="hspace">&nbsp;</span><span class="schemesymbol">x</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr></table></p><p>This creates a link, which, when clicked, prints <span class="stt">x is 1</span>. If you reload the page, however, you&rsquo;ll see something like <span class="stt">Expired or missing function </span><span class="stt">&rsquo;</span><span class="stt">q7c5ysd4935xhbhx2xbu</span><span class="stt">&rsquo;</span><span class="stt"></span>. Changing the first sub-form passed to <span class="schemesymbol">body-as-url</span> to <span class="schemeparen">(</span><span class="schemesymbol">req</span><span class="stt"> </span><span class="schemeparen">#:sticky</span><span class="schemeparen">)</span> makes it so that successive hits to the link result in increasing values of <span class="schemesymbol">x</span>.</p><h4>3.4<tt>&nbsp;</tt><a name="(part._.Users)"></a>Users</h4><p>LeftParen provides built-in functionality for dealing with users, including registering users, logging users in and out, and storing persistent data about users. To get up-and-running quickly, you can use the high-level <span class="schemesymbol">welcome-message</span> function:</p><p><table cellspacing="0" class="boxed"><tr><td><table cellspacing="0" class="prototype"><tr><td><span class="schemeparen">(</span><span class="schemesymbol">welcome-message</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemevariable">session</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span>[</td><td><span class="schemeparen">#:on-success</span><span class="hspace">&nbsp;</span><span class="schemevariable">success-fn</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:no-register</span><span class="hspace">&nbsp;</span><span class="schemevariable">no-register</span>]<span class="schemeparen">)</span></td><td><span class="hspace">&nbsp;</span></td><td>&rarr;</td><td><span class="hspace">&nbsp;</span></td><td><span class="schemesymbol">xexpr</span></td></tr></table></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">session</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">session?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">success-fn</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">or/c</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">-&gt;</span><span class="hspace">&nbsp;</span><span class="schemesymbol">user?</span><span class="hspace">&nbsp;</span><span class="schemesymbol">xexpr?</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span><span class="schemevalue">#f</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="schemevalue">#f</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">no-register</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">boolean?</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="schemevalue">#f</span></td></tr></table></p><p>The function <span class="schemesymbol">welcome-message</span> produces a small area of text and links (commonly found in the top-right area of a web app). If the user is not currently logged in, login and register links are presented. If the user is logged in, a message welcoming them is displayed, along with a link to log out.</p><p><table cellspacing="0" class="boxed"><tr><td><span class="schemeparen">(</span><span class="schemesymbol">current-user</span><span class="hspace">&nbsp;</span><span class="schemevariable">session</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">or/c</span><span class="hspace">&nbsp;</span><span class="schemesymbol">user?</span><span class="hspace">&nbsp;</span><span class="schemevalue">#f</span><span class="schemeparen">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">session</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">session?</span></td></tr></table></p><p>The function <span class="schemesymbol">current-user</span> returns the current user record, or <span class="schemevalue">#f</span> if no user is available in the current session.</p><p>As an example, here is the complete page code for a web app that allows users to register, login and logout, and which prints a secret message if the user is logged in:</p><p><table cellspacing="0" class="schemeblock"><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">define-session-page</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">index-page</span><span class="hspace">&nbsp;</span><span class="schemesymbol">req</span><span class="hspace">&nbsp;</span><span class="schemesymbol">sesh</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">**</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">welcome-message</span><span class="hspace">&nbsp;</span><span class="schemesymbol">sesh</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">aif</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">current-user</span><span class="hspace">&nbsp;</span><span class="schemesymbol">sesh</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">format</span><span class="hspace">&nbsp;</span><span class="schemevalue">"The secret, ~A, is 42."</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">rec-prop</span><span class="hspace">&nbsp;</span><span class="schemesymbol">it</span><span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">username</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemevalue">"No secret for you."</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr></table></p><p>Note that <span class="schemesymbol">aif</span> is available in the <a href="/#(part._utilities)">Utility Functions</a> included with LeftParen.</p><h4>3.5<tt>&nbsp;</tt><a name="(part._.Feeds)"></a>Feeds</h4><p>You can create Atom or RSS feeds in your web app. A feed in LeftParen is just a page crafted in a paricular way. The core functions involved are <span class="schemesymbol">atom-feed</span> and <span class="schemesymbol">rss-feed</span>:</p><p><table cellspacing="0" class="boxed"><tr><td><table cellspacing="0" class="prototype"><tr><td><span class="schemeparen">(</span><span class="schemesymbol">atom-feed</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemevariable">atom-feed-page</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:feed-title</span><span class="hspace">&nbsp;</span><span class="schemevariable">feed-title</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:feed-updated/epoch-seconds</span><span class="hspace">&nbsp;</span><span class="schemevariable">updated-seconds</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:author-name</span><span class="hspace">&nbsp;</span><span class="schemevariable">author-name</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span>[</td><td><span class="schemeparen">#:feed-description</span><span class="hspace">&nbsp;</span><span class="schemevariable">feed-description</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:feed-id</span><span class="hspace">&nbsp;</span><span class="schemevariable">feed-id</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:related-content-link</span><span class="hspace">&nbsp;</span><span class="schemevariable">related-content-link</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:items</span><span class="hspace">&nbsp;</span><span class="schemevariable">atom-items</span>]<span class="schemeparen">)</span></td><td><span class="hspace">&nbsp;</span></td></tr></table></td></tr><tr><td><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="schemesymbol">response/full?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">atom-feed-page</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">page?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">feed-title</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">updated-seconds</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">integer?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">author-name</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">feed-description</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">or/c</span><span class="hspace">&nbsp;</span><span class="schemevalue">#f</span><span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="schemevalue">#f</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">feed-id</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="schemesymbol">THE_URL_OF_THE_GIVEN_ATOM_FEED_PAGE</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">related-content-link</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="schemesymbol">THE_LINK_TO_YOUR_WEB_APP</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">atom-items</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">list-of</span><span class="hspace">&nbsp;</span><span class="schemesymbol">atom-item?</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">(</span><span class="schemevalue">)</span></td></tr></table></p><p><table cellspacing="0" class="boxed"><tr><td><table cellspacing="0" class="prototype"><tr><td><span class="schemeparen">(</span><span class="schemesymbol">rss-feed</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemevariable">rss-feed-page</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:feed-title</span><span class="hspace">&nbsp;</span><span class="schemevariable">feed-title</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:feed-description</span><span class="hspace">&nbsp;</span><span class="schemevariable">feed-description</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span>[</td><td><span class="schemeparen">#:related-content-link</span><span class="hspace">&nbsp;</span><span class="schemevariable">related-content-link</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:items</span><span class="hspace">&nbsp;</span><span class="schemevariable">rss-items</span>]<span class="schemeparen">)</span></td><td><span class="hspace">&nbsp;</span></td></tr></table></td></tr><tr><td><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="schemesymbol">response/full?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">rss-feed-page</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">page?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">feed-title</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">feed-description</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">related-content-link</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="schemesymbol">THE_LINK_TO_YOUR_WEB_APP</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">rss-items</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">list-of</span><span class="hspace">&nbsp;</span><span class="schemesymbol">rss-item?</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="schemevalue">'</span><span class="schemevalue">(</span><span class="schemevalue">)</span></td></tr></table></p><p>The <span class="schemeparen">#:items</span> argument in each of these functions is a list of items constructed with <span class="schemesymbol">atom-item</span> and <span class="schemesymbol">rss-item</span>:</p><p><table cellspacing="0" class="boxed"><tr><td><table cellspacing="0" class="prototype"><tr><td><span class="schemeparen">(</span><span class="schemesymbol">atom-item</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:title</span><span class="hspace">&nbsp;</span><span class="schemevariable">title</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:url</span><span class="hspace">&nbsp;</span><span class="schemevariable">url</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:updated-epoch-seconds</span><span class="hspace">&nbsp;</span><span class="schemevariable">updated-seconds</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span>[</td><td><span class="schemeparen">#:content</span><span class="hspace">&nbsp;</span><span class="schemevariable">content</span>]<span class="schemeparen">)</span></td><td><span class="hspace">&nbsp;</span></td></tr></table></td></tr><tr><td><span class="hspace">&nbsp;</span>&rarr;<span class="hspace">&nbsp;</span><span class="schemesymbol">atom-item?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">title</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">url</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">updated-seconds</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">integer?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">content</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">or/c</span><span class="hspace">&nbsp;</span><span class="schemevalue">#f</span><span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="schemevalue">#f</span></td></tr></table></p><p><table cellspacing="0" class="boxed"><tr><td><table cellspacing="0" class="prototype"><tr><td><span class="schemeparen">(</span><span class="schemesymbol">rss-item</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:title</span><span class="hspace">&nbsp;</span><span class="schemevariable">title</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="schemeparen">#:url</span><span class="hspace">&nbsp;</span><span class="schemevariable">url</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td><td><span class="hspace">&nbsp;</span>[</td><td><span class="schemeparen">#:content</span><span class="hspace">&nbsp;</span><span class="schemevariable">content</span>]<span class="schemeparen">)</span></td><td><span class="hspace">&nbsp;</span></td><td>&rarr;</td><td><span class="hspace">&nbsp;</span></td><td><span class="schemesymbol">rss-item?</span></td></tr></table></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">title</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">url</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemevariable">content</span><span class="hspace">&nbsp;</span>:<span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">or/c</span><span class="hspace">&nbsp;</span><span class="schemevalue">#f</span><span class="hspace">&nbsp;</span><span class="schemesymbol">string?</span><span class="schemeparen">)</span><span class="hspace">&nbsp;</span>=<span class="hspace">&nbsp;</span><span class="schemevalue">#f</span></td></tr></table></p><p>Here&rsquo;s an example Atom feed page:</p><p><table cellspacing="0" class="schemeblock"><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">define-page</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">article-feed-page</span><span class="hspace">&nbsp;</span><span class="schemesymbol">req</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">#:blank</span><span class="hspace">&nbsp;</span><span class="schemevalue">#t</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">atom-feed</span><span class="hspace">&nbsp;</span><span class="schemesymbol">article-feed-page</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:feed-title</span><span class="hspace">&nbsp;</span><span class="schemevalue">"LeftParen blog"</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:feed-description</span><span class="hspace">&nbsp;</span><span class="schemevalue">"On LeftParen..."</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:feed-updated/epoch-seconds</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">current-seconds</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:author-name</span><span class="hspace">&nbsp;</span><span class="schemevalue">"LP staffers"</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:items</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">list</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">atom-item</span><span class="hspace">&nbsp;</span><span class="schemeparen">#:title</span><span class="hspace">&nbsp;</span><span class="schemevalue">"Status update..."</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:url</span><span class="hspace">&nbsp;</span><span class="schemevalue">"http://blog.../50308696"</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:updated-epoch-seconds</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">current-seconds</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:content</span><span class="hspace">&nbsp;</span><span class="schemevalue">"I&#8217;m nearing a..."</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">atom-item</span><span class="hspace">&nbsp;</span><span class="schemeparen">#:title</span><span class="hspace">&nbsp;</span><span class="schemevalue">"LeftParen 0.3..."</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:updated-epoch-seconds</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">current-seconds</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:url</span><span class="hspace">&nbsp;</span><span class="schemevalue">"http://blog.../51814971"</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">#:content</span><span class="hspace">&nbsp;</span><span class="schemevalue">"Tonight I..."</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr></table></p><p>Note that while using <span class="schemesymbol">current-seconds</span> for timestamps does satisfy the interface, it&rsquo;s not really appropriate since these times are supposed to indicated freshness of the data. If basing your feed off of records, you might consider using <span class="schemesymbol">created-when</span>.</p><h3>4<tt>&nbsp;</tt><a name="(part._utilities)"></a>Utility Functions</h3><p>Some <a href="http://github.com/vegashacker/leftparen/commits/master/util.scm">miscellaneous utility functions</a> are available along with LeftParen. To be able to use these functions, you&rsquo;ll need to require <span class="stt">util.scm</span> at the top of your module. Something like this is common:</p><p><table cellspacing="0" class="schemeblock"><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">require</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">planet</span><span class="hspace">&nbsp;</span><span class="schemevalue">"leftparen.scm"</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemevalue">"vegashacker"</span><span class="hspace">&nbsp;</span><span class="schemevalue">"leftparen.plt"</span><span class="hspace">&nbsp;</span><span class="schemevalue">5</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">=</span><span class="hspace">&nbsp;</span><span class="schemevalue">1</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr><tr><td><span class="schemeplain"><span class="hspace">&nbsp;&nbsp;</span></span><span class="hspace">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">planet</span><span class="hspace">&nbsp;</span><span class="schemevalue">"util.scm"</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemevalue">"vegashacker"</span><span class="hspace">&nbsp;</span><span class="schemevalue">"leftparen.plt"</span><span class="hspace">&nbsp;</span><span class="schemevalue">5</span><span class="hspace">&nbsp;</span><span class="schemeparen">(</span><span class="schemesymbol">=</span><span class="hspace">&nbsp;</span><span class="schemevalue">1</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span><span class="schemeparen">)</span></td></tr></table></p><h3>5<tt>&nbsp;</tt><a name="(part._.About_.Acknowledgements)"></a>About/Acknowledgements</h3><p>LeftParen was initially written by <a href="http://robhunter.org">Rob Hunter</a>. It makes use of <a href="http://planet.plt-scheme.org/display.ss?package=dispatch.plt&amp;owner=untyped">Dispatch</a> by <a href="http://untyped.com/">Untyped</a>, <a href="http://planet.plt-scheme.org/display.ss?package=with-bindings.plt&amp;owner=jaymccarthy">with-bindings</a> by <a href="http://jay-mccarthy.blogspot.com/">Jay McCarthy</a>, and of course, <a href="http://www.plt-scheme.org/">PLT Scheme</a>.</p><p>LeftParen used to use <a href="http://planet.plt-scheme.org/display.ss?package=web.plt&amp;owner=soegaard">WEB</a> by <a href="http://scheme.dk/blog/">Jens Axel Soegaard</a> and <a href="http://planet.plt-scheme.org/display.ss?package=instaservlet.plt&amp;owner=untyped">Instaservlet</a> (now deprecated) by <a href="http://untyped.com/">Untyped</a>, which were both very helpful in getting the project started.</p><h4>5.1<tt>&nbsp;</tt><a name="(part._.Code_.Contributors)"></a>Code Contributors</h4><ul><li><p>Bill Hager</p></li><li><p>Joshua Herman</p></li></ul></div></div></body></html>
Jump to Line
Something went wrong with that request. Please try again.