[clouchdb-cvs] CVS clouchdb/public_html

peddy peddy at common-lisp.net
Mon Jun 30 00:52:47 UTC 2008


Update of /project/clouchdb/cvsroot/clouchdb/public_html
In directory clnet:/tmp/cvs-serv25900/public_html

Modified Files:
	index.html 
Log Message:
Added Lisp/JSON field type table, minor text fixes


--- /project/clouchdb/cvsroot/clouchdb/public_html/index.html	2008/06/29 17:30:59	1.2
+++ /project/clouchdb/cvsroot/clouchdb/public_html/index.html	2008/06/30 00:52:47	1.3
@@ -829,17 +829,81 @@
   </p>
 
   <p>
-    The value of a document field may be a string, a number, a list,
-    or an associative list. Document field values may be nested to
-    create arbitrarily complex document structures.
+    The value of a document field may be a string, a number, a list, a
+    boolean, or an associative list. Document field values may be
+    nested to create arbitrarily complex document structures.
   </p>
 
+  <table summary="Field Names and Values">
+   <caption><em>Representation of Field Names and Values</em></caption>
+   <tr>
+     <th>Description</th>
+     <th>Lisp</th>
+     <th>JSON</th>
+   </tr>
+   <tr>
+     <td>Boolean</td>
+     <td>(:boolean . t) <br/>
+       (:boolean . nil)</td>
+     <td>"BOOLEAN" : true <br />
+     "BOOLEAN" : false | null</td>
+   </tr>
+   <tr>
+     <td>String</td>
+     <td>(:string . "Example")</td>
+     <td>"STRING" : "Example"</td>
+   </tr>
+   <tr>
+     <td>Keywords</td>
+     <td>
+       (:keyword . example)<br />
+       (:keyword . :example)<br />
+       (:keyword . |Example|)<br /><br />
+       Note: Keywords are always converted to strings       
+     </td>
+     <td>
+       "KEYWORD" : "EXAMPLE"<br />
+       "KEYWORD" : "EXAMPLE"<br />
+       "KEYWORD" : "Example"
+     </td>
+   </tr>
+   <tr>
+     <td>Number</td>
+     <td>(:number . 42)</td>
+     <td>"NUMBER" : 42</td>
+   </tr>
+   <tr>
+     <td>Floating Point Number</td>
+     <td>(:number . 42.0)</td>
+     <td>"NUMBER" : 42.0</td>
+   </tr>
+   <tr>
+     <td>Lisp List/JSON Array</td>
+     <td>(:list . (1 2 3)) <br /> (:list 1 2 3)</td>
+     <td>"LIST" : [1,2,3]</td>
+   </tr>
+   <tr>
+     <td>Lisp Associative Array/JSON Object</td>
+     <td>(:person . ((:name . "Bruce") (:gender . m)))</td>
+     <td>"PERSON" : {"NAME": "Bruce", "GENDER": "M"}</td>
+   </tr>
+  </table>
+
+<p/><p/>
+
+<p>
+  Though these types are simple, lists and associative lists may
+  contain other lists or associative lists, permitting a rich document
+  structure.
+</p>
+
 <pre class="code">
 (create-document '((:string . "String Value")
                    (:number . 42.0)
                    (:list . (milk eggs "green beans"))
                    (:alist . ((:string . "Another String")
                               (:size . 3)
+                              (:false . t)
                               (:list . ("un" "deux" "trois"))
                               (:another-alist . ((a . "A") (b . "B")))))))
 </pre>
@@ -1093,7 +1157,7 @@
 ;; Create document "A"
 (put-document '((:name . "Larrabee")) :id "A")
 
-;; Copy to new document "B"
+;; Copy document A to new document "B"
 (put-document (get-document "A") :id "B")
 
 ;; Add field to document "B"
@@ -1163,7 +1227,7 @@
                    ((:agent . 44))
                    ((:agent . 13))
                    ((:name . "Hymie"))
-                   ((:name . " Larrabee"))
+                   ((:name . "Larrabee"))
                    ((:name . "Fang") (:agent . "K-9"))))
                  (:kaos
                   (((:name . "Siegfried"))
@@ -1366,9 +1430,10 @@
 </pre>
 
 <p>
-  Ok, but JavaScript looks exotic and scary. To solve this problem we
-  use Parenscript. The following expression generates the same ad-hoc
-  view as above, but with a more comfortable syntax:
+  Ok, but JavaScript looks exotic and scary. The
+  following <a href="http://www.cliki.net/Parenscript/">Parenscript</a>
+  expression generates the same ad-hoc view as above, but with a more
+  comfortable syntax:
 </p>
 
 <pre class="code">
@@ -1409,9 +1474,11 @@
   s-expresions.
 </p>
 <p>
-The following example document, taken from the
+The following document, taken from the
 <a href="http://wiki.apache.org/couchdb/HttpViewApi">CouchDb
-HttpViewAPI Wiki</a>, represents a native JavaScript CouchDb View document:
+HttpViewAPI Wiki</a>, is an example of a native JavaScript CouchDb
+View document that defines three view components "all",
+"by_lastname", and "total_purchases":
 </p>
 <pre class="code">
 {
@@ -1460,7 +1527,7 @@
       (return (sum values)))))
 </pre>
 <p>
-  Note that the defuns in the example above create JavaScript
+  Note that the defuns in the example above define JavaScript
   functions, not Lisp functions, and that there are some capitization
   differences between the JavaScript and ParenScript view documents.
 </p>




More information about the clouchdb-cvs mailing list