ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  ANSI Common Lisp   22 Printer   22.1 The Lisp Printer

22.1.4 Examples of Printer Behavior

 (let ((*print-escape* t)) (fresh-line) (write #\a))
#\a
 #\a
 (let ((*print-escape* nil) (*print-readably* nil))
   (fresh-line)
   (write #\a))
 a
 #\a
 (progn (fresh-line) (prin1 #\a))
#\a
 #\a
 (progn (fresh-line) (print #\a))

#\a
 #\a
 (progn (fresh-line) (princ #\a))
 a
 #\a

 (dolist (val '(t nil))
   (let ((*print-escape* val) (*print-readably* val))
     (print '#\a) 
     (prin1 #\a) (write-char #\Space)
     (princ #\a) (write-char #\Space)
     (write #\a)))
#\a #\a a #\a
#\a #\a a a
  NIL

 (progn (fresh-line) (write '(let ((a 1) (b 2)) (+ a b))))
(LET ((A 1) (B 2)) (+ A B))
 (LET ((A 1) (B 2)) (+ A B))

 (progn (fresh-line) (pprint '(let ((a 1) (b 2)) (+ a b))))
(LET ((A 1)
      (B 2))               
  (+ A B))
 (LET ((A 1) (B 2)) (+ A B))

 (progn (fresh-line) 
        (write '(let ((a 1) (b 2)) (+ a b)) :pretty t))
(LET ((A 1)
      (B 2))
  (+ A B))                 
 (LET ((A 1) (B 2)) (+ A B))

 (with-output-to-string (s)  
    (write 'write :stream s)
    (prin1 'prin1 s))
 "WRITEPRIN1"


Home Previous Up Next Table of Contents Index
© Franz Inc. 1998-2015 - File last updated 03-23-2015