picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit 764cce7c7eb955ecad87625d0c433d5d1baad3e5
parent ba8a0ca1f44cd05383f99524044dc60b60e14e50
Author: Alexander Burger <abu@software-lab.de>
Date:   Mon,  9 May 2011 08:38:28 +0200

More clean-up
Diffstat:
Mdoc/tut.html | 138+++++++++++++++++++++++++++++++++++++++++++++----------------------------------
Mersatz/picolisp.jar | 0
Msrc/vers.h | 2+-
Msrc64/version.l | 4++--
4 files changed, 82 insertions(+), 62 deletions(-)

diff --git a/doc/tut.html b/doc/tut.html @@ -342,8 +342,7 @@ and indented way. : (pp 'pretty) (de pretty (X N . @) (setq N (abs (space (or N 0)))) - (while (args) - (printsp (next)) ) + (while (args) (printsp (next))) (if (or (atom X) (>= 12 (size X))) (print X) (while (== 'quote (car X)) @@ -351,27 +350,34 @@ and indented way. (pop 'X) ) (let Z X (prin "(") - (when (memq (print (pop 'X)) *PP) - (cond - ((memq (car Z) *PP1) - (if (and (pair (car X)) (pair (cdar X))) - (when (>= 12 (size (car X))) + (cond + ((memq (print (pop 'X)) *PP) + (cond + ((memq (car Z) *PP1) + (if (and (pair (car X)) (pair (cdar X))) + (when (>= 12 (size (car X))) + (space) + (print (pop 'X)) ) (space) - (print (pop 'X)) ) + (print (pop 'X)) + (when + (or + (atom (car X)) + (>= 12 (size (car X))) ) + (space) + (print (pop 'X)) ) ) ) + ((memq (car Z) *PP2) + (inc 'N 3) + (loop + (prinl) + (pretty (cadr X) N (car X)) + (NIL (setq X (cddr X)) (space)) ) ) + ((or (atom (car X)) (>= 12 (size (car X)))) (space) - (print (pop 'X)) - (when (or (atom (car X)) (>= 12 (size (car X)))) - (space) - (print (pop 'X)) ) ) ) - ((memq (car Z) *PP2) - (inc 'N 3) - (loop - (prinl) - (pretty (cadr X) N (car X)) - (NIL (setq X (cddr X)) (space)) ) ) - ((or (atom (car X)) (>= 12 (size (car X)))) - (space) - (print (pop 'X)) ) ) ) + (print (pop 'X)) ) ) ) + ((and (memq (car Z) *PP3) (>= 12 (size (head 2 X)))) + (space) + (print (pop 'X) (pop 'X)) ) ) (when X (loop (T (== Z X) (prin " .")) @@ -453,8 +459,8 @@ somewhere in their value or property list. <pre><code> : (who 'print) --> ((print> . +relation) query show select pretty "edit" msg rules pp more -(print> . +Date)) </code></pre> +-> (query pretty pp msg more "edit" view show (print> . +Date) rules select +(print> . +relation))</code></pre> <p>A dotted pair indicates either a method definition or a property entry. So <code>(print> . +relation)</code> denotes the <code>print&gt;</code> method of @@ -465,10 +471,20 @@ the <code><a href="refR.html#+relation">+relation</a></code> class. <pre><code> : (more (who 'print) pp) -(dm (print> . +relation) (Val) # Pretty-print these functions one by one - (print Val) ) +(de query ("Q" "Dbg") # Pretty-print these functions one by one + (use "R" + (loop + (NIL (prove "Q" "Dbg")) + (T (=T (setq "R" @)) T) + (for X "R" + (space) + (print (car X)) + (print '=) + (print (cdr X)) + (flush) ) + (T (line)) ) ) ) -(de query ("Q" "Dbg") +(de pretty (X N . @) ... </code></pre> @@ -497,10 +513,11 @@ list is suitable for iteration with <code>pp</code>: <pre><code> : (can 'del>) # Which classes accept 'del>' ? --> ((del> . +relation) (del> . +Entity) (del> . +List)) +-> ((del> . +List) (del> . +Entity) (del> . +relation)) + : (more (can 'del>) pp) # Inspect the methods with 'pp' -(dm (del> . +relation) (Obj Old Val) - (and (&lt;> Old Val) Val) ) +(dm (del> . +List) (Obj Old Val) + (and ((&lt;> Old Val) (delete Val Old)) ) (dm (del> . +Entity) (Var Val) (when @@ -513,10 +530,12 @@ list is suitable for iteration with <code>pp</code>: This Old (put This Var (del> (meta This Var) This Old @)) ) + (when (asoq Var (meta This 'Aux)) + (relAux This Var Old (cdr @)) ) (upd> This Var Old) ) ) ) -(dm (del> . +List) (Obj Old Val) - (and (&lt;> Old Val) (delete Val Old)) ) +(dm (del> . +relation) (Obj Old Val) + (and ((&lt;> Old Val) Val) ) </code></pre> <h3>Inspect dependencies with <i>dep</i></h3> @@ -531,17 +550,17 @@ class hierarchy. That is, for a given class it displays the tree of its <pre><code> : (dep '+relation) +relation - +Number - +Time - +Date - +Symbol - +String + +Bag + +Any +Blob +Link +Joint +Bool - +Any - +Bag + +Symbol + +String + +Number + +Time + +Date -> +relation </code></pre> @@ -599,6 +618,7 @@ Hello world : (de hello (X) (prinl "Hello " X) ) # hello redefined +-> hello </code></pre> <p>PicoLisp informs you that you have just redefined the function. This might be @@ -755,7 +775,7 @@ also <a href="faq.html#lambda">this FAQ entry</a>). </code></pre> <pre><code> -: (setq f '((X) (* X X))) +: (setq f '((X) (* X X))) # This is equivalent to (de f (X) (* X X)) -> ((X) (* X X)) : f -> ((X) (* X X)) @@ -786,7 +806,7 @@ exited. <p>For demonstration, let's define the unavoidable factorial function (or just <code><a href="refL.html#load">load</a></code> the file "<code><a -href="fun.l">doc/fun.l</a></code>"): +href="fun.l">@doc/fun.l</a></code>"): <pre><code> (de fact (N) @@ -1040,7 +1060,7 @@ href="refI.html#in">in</a></code>. Note that comments and white space are automatically skipped by <code>read</code>: <pre><code> -: (in "doc/fun.l" (read)) +: (in "@doc/fun.l" (read)) -> (de fact (N) (if (=0 N) 1 (* N (fact (dec N))))) </code></pre> @@ -1049,7 +1069,7 @@ directly. To get the first non-white character in the file with <code><a href="refC.html#char">char</a></code>: <pre><code> -: (in "doc/fun.l" (skip "#") (char)) +: (in "@doc/fun.l" (skip "#") (char)) -> "(" </code></pre> @@ -1059,7 +1079,7 @@ stream for given patterns. Typically, this is not done with Lisp source files immediately following <code>fact</code> in the file, <pre><code> -: (in "doc/fun.l" (while (from "fact ") (println (read)))) +: (in "@doc/fun.l" (while (from "fact ") (println (read)))) (N) (dec N) </code></pre> @@ -1068,7 +1088,7 @@ immediately following <code>fact</code> in the file, href="refT.html#till">till</a></code>: <pre><code> -: (in "doc/fun.l" (from "(de ") (till " " T))) +: (in "@doc/fun.l" (from "(de ") (till " " T))) -> "fact" </code></pre> @@ -1078,14 +1098,14 @@ read, either into a single <a href="ref.html#transient-io">transient</a> symbol (the type used by PicoLisp for strings), <pre><code> -: (in "doc/tut.html" (line T)) +: (in "@doc/tut.html" (line T)) -> "&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://..." </code></pre> <p>or into a list of symbols (characters): <pre><code> -: (in "doc/tut.html" (line)) +: (in "@doc/tut.html" (line)) -> ("&lt;" "!" "D" "O" "C" "T" "Y" "P" "E" " " "H" "T" "M" "L" ... </code></pre> @@ -1112,7 +1132,7 @@ fields. A typical way to import the contents of such a file is: (out "b" # from file "a" to file "b" (echo 40) ) ) -(in "doc/tut.html" # Show the HTTP-header +(in "@doc/tut.html" # Show the HTTP-header (line) (echo "&lt;body>") ) @@ -1321,11 +1341,11 @@ site, and prints it to standard output: <p>We recommend that you have a terminal window open, and try the examples by yourself. You may either type them in, directly to the PicoLisp interpreter, or -edit a separate source file (e.g. <code>"doc/fun.l"</code>) in a second terminal -window and load it into PicoLisp with +edit a separate source file (e.g. <code>"@doc/fun.l"</code>) in a second +terminal window and load it into PicoLisp with <pre><code> -: (load "doc/fun.l") +: (load "@doc/fun.l") </code></pre> <p>each time you have modified and saved it. @@ -1388,7 +1408,7 @@ hierarchy of geometric shapes, with a base class <code>+Shape</code> and two subclasses <code>+Rectangle</code> and <code>+Circle</code>. <p>The source code is included as "<code><a -href="shape.l">doc/shape.l</a></code>" in the PicoLisp distribution, so you +href="shape.l">@doc/shape.l</a></code>" in the PicoLisp distribution, so you don't have to type it in. Just <code><a href="refL.html#load">load</a></code> the file, or start it from the shell as: @@ -1780,7 +1800,7 @@ entity/relation class framework (see also <a href="ref.html#dbase">Database</a>) which allows a close mapping of the application data structure to the database. <p>We provided a simple yet complete database and GUI demo application in -<code><a href="family.l">doc/family.l</a></code>. We recommend to start it up +<code><a href="family.l">@doc/family.l</a></code>. We recommend to start it up for test purposes in the following way: <pre><code> @@ -2039,10 +2059,10 @@ XHTML/CSS framework with the optional use of JavaScript. <p>Before we explain the GUI of our demo database application, we present a minimal example for a plain HTML-GUI in <code><a -href="hello.l">doc/hello.l</a></code>. Start the application server as: +href="hello.l">@doc/hello.l</a></code>. Start the application server as: <pre><code> -$ pil @lib/http.l -'server 8080 "doc/hello.l"' -wait +$ pil @lib/http.l -'server 8080 "@doc/hello.l"' -wait </code></pre> <p>Now point your browser to the address '<code><a @@ -2056,7 +2076,7 @@ window. <p>In our demo database application, a single function <code>person</code> is responsible for the whole GUI. Again, please look at <code><a -href="family.l">doc/family.l</a></code>. +href="family.l">@doc/family.l</a></code>. <p>To start the database <i>and</i> the application server, call: @@ -2065,7 +2085,7 @@ $ pil @doc/family.l -main -go + </code></pre> <p>As before, the database is opened with <code>main</code>. The function -<code>go</code> is also defined in <code>doc/family.l</code>: +<code>go</code> is also defined in <code>@doc/family.l</code>: <pre><code> (de go () @@ -2081,7 +2101,7 @@ href="http://localhost:8080" target="GUI">http://localhost:8080</a></code>'. <p>You should see a new browser window with an input form created by the function <code>person</code>. We provided an initial database in -"doc/family/[1-4]". You can navigate through it by clicking on the pencil icons +"@doc/family/[1-4]". You can navigate through it by clicking on the pencil icons besides the input fields. <p>The chart with the children data can be scrolled using the down @@ -2211,7 +2231,7 @@ to the <a href="ref.html#pilog">Pilog</a> section of the PicoLisp Reference for the basic usage of Pilog. <p>Again, we use our demo application <code><a -href="family.l">doc/family.l</a></code> that was introduced in the <a +href="family.l">@doc/family.l</a></code> that was introduced in the <a href="#db">Database Programming</a> section. <p>Normally, Pilog is used either interactively to query the database during @@ -2363,7 +2383,7 @@ kids nm)</code> <p>A more typical and extensive example for the usage of <code>select</code> can be found in the <code>qPerson</code> function in <code><a -href="family.l">doc/family.l</a></code>. It is used in the search dialog of the +href="family.l">@doc/family.l</a></code>. It is used in the search dialog of the demo application, and searches for a person with the name, the parents' and partner's names, the occupation and a time range for the birth date. The relevant index trees in the database are searched (actually only those trees diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar Binary files differ. diff --git a/src/vers.h b/src/vers.h @@ -1 +1 @@ -static byte Version[4] = {3,0,6,8}; +static byte Version[4] = {3,0,6,9}; diff --git a/src64/version.l b/src64/version.l @@ -1,6 +1,6 @@ -# 05may11abu +# 09may11abu # (c) Software Lab. Alexander Burger -(de *Version 3 0 6 8) +(de *Version 3 0 6 9) # vi:et:ts=3:sw=3