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 afebe19768b86e79ded1ab0e91e9dd97e59588bc
parent ecb0848fcbfc8a1098d76b7d03e77844118deda6
Author: Commit-Bot <unknown>
Date:   Thu, 27 May 2010 19:44:14 +0000

Automatic commit from picoLisp.tgz, From: Thu, 27 May 2010 16:44:14 GMT
Diffstat:
Mdoc/refV.html | 77++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
Mlib.l | 41+++++++++++++++++++++++++----------------
Msrc64/version.l | 4++--
3 files changed, 77 insertions(+), 45 deletions(-)

diff --git a/doc/refV.html b/doc/refV.html @@ -115,46 +115,69 @@ href="refP.html#pp">pp</a></code>. -> T </code></pre> -<dt><a name="view"><code>(view 'lst) -> any</code></a> -<dd>Views <code>lst</code> as tree-structured ASCII graphics. See also <code><a +<dt><a name="view"><code>(view 'lst ['T]) -> any</code></a> +<dd>Views <code>lst</code> as tree-structured ASCII graphics. When the +<code>T</code> argument is given, <code>lst</code> should be a binary tree +structure (as generated by <code><a href="refI.html#idx">idx</a></code>), which +is then shown as a left-rotated tree. See also <code><a href="refP.html#pretty">pretty</a></code> and <code><a href="refS.html#show">show</a></code>. <pre><code> -: (view '(a (b c d) (e (f (g) (h) (i)) (j (k) (l) (m))) (n o p) q)) -+-- a -| -+---+-- b -| | -| +-- c -| | -| +-- d +: (balance 'I '(a b c d e f g h i j k l m n o)) +-> NIL +: I +-> (h (d (b (a) c) f (e) g) l (j (i) k) n (m) o) + +: (view I) ++-- h | -+---+-- e ++---+-- d | | -| +---+-- f -| | | -| | +---+-- g +| +---+-- b | | | -| | +---+-- h +| | +---+-- a | | | -| | +---+-- i +| | +-- c +| | +| +-- f | | -| +---+-- j -| | -| +---+-- k -| | -| +---+-- l -| | -| +---+-- m +| +---+-- e +| | +| +-- g +| ++-- l | -+---+-- n ++---+-- j | | -| +-- o +| +---+-- i | | -| +-- p +| +-- k +| ++-- n +| ++---+-- m | -+-- q ++-- o +-> NIL + +: (view I T) + o + n + m + l + k + j + i +h + g + f + e + d + c + b + a +-> NIL </code></pre> </dl> diff --git a/lib.l b/lib.l @@ -1,4 +1,4 @@ -# 25apr10abu +# 27may10abu # (c) Software Lab. Alexander Burger (de task (Key . Prg) @@ -350,20 +350,29 @@ "X" ) ) "X" ) ) -(de view (X L) - (let (Z X *Dbg) - (loop - (T (atom X) (println X)) - (if (atom (car X)) - (println '+-- (pop 'X)) - (print '+---) - (view - (pop 'X) - (append L (cons (if X "| " " "))) ) ) - (NIL X) - (mapc prin L) - (T (== Z X) (println '*)) - (println '|) - (mapc prin L) ) ) ) +(de view (X Y) + (let *Dbg NIL + (if (=T Y) + (let N 0 + (recur (N X) + (when X + (recurse (+ 3 N) (cddr X)) + (space N) + (println (car X)) + (recurse (+ 3 N) (cadr X)) ) ) ) + (let Z X + (loop + (T (atom X) (println X)) + (if (atom (car X)) + (println '+-- (pop 'X)) + (print '+---) + (view + (pop 'X) + (append Y (cons (if X "| " " "))) ) ) + (NIL X) + (mapc prin Y) + (T (== Z X) (println '*)) + (println '|) + (mapc prin Y) ) ) ) ) ) # vi:et:ts=3:sw=3 diff --git a/src64/version.l b/src64/version.l @@ -1,6 +1,6 @@ -# 19may10abu +# 27may10abu # (c) Software Lab. Alexander Burger -(de *Version 3 0 2 23) +(de *Version 3 0 2 24) # vi:et:ts=3:sw=3