File: print.lisp

package info (click to toggle)
mcvs 1.0.13-8
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 668 kB
  • ctags: 648
  • sloc: lisp: 5,091; ansic: 223; sh: 190; makefile: 58
file content (24 lines) | stat: -rw-r--r-- 639 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
;;; This source file is part of the Meta-CVS program, 
;;; which is distributed under the GNU license.
;;; Copyright 2002 Kaz Kylheku

(provide "print")

(defun print-assoc-list (alist &optional (stream *standard-output*))
"Print an association list in this nice form
 ((a b ...)
  (c d ...)
  ...
  (e f ...))"
 (cond
   ((null alist)
      (write nil :stream stream))
   ((not (consp alist))
      (error "PRINT-ASSOC-LIST: ~a is not a list." alist))
   (t (format stream "(~s" (first alist))
      (loop
	(setf alist (rest alist))
	(when (null alist)
	  (write-string ")" stream)
	  (return))
	(format stream "~& ~s" (first alist))))))