Supressed Printing.



; The Instprog library is growing - now it defines 146 functions  
; and 87 macros, although many of these are duplicated, for example,
; set-undefined and SU do same thing, much like USA and united-states-...
; I admit, most of these are more, well, "conceptual" than practical.
;
; In recent versions, all functions and macros in the library are
; protected with my function protect1 already described in this
; blog. Although I do not use contexts, the naming conventions
; should ensure that functions and macros are equally "safe".
;
; Also, the library is pretty verbose. It performs about 60 tests
; and report results. In recent versions I redefined functions
; print and println so these reports can be turned off.

(set 'print.supressed true
     'println.supressed true)
     
(load "http://www.instprog.com/Instprog.default-library.lsp")

(set 'print.supressed nil
     'println.supressed nil)
     
(exit)

; Redefinitions of print and println are in the library, so after
; library is loaded, any printing can be supressed on the same way.

(set 'print.original print 'println.original println)
(set 'lambda-last (lambda()(last(args))))

(constant 'print
          (lambda-macro()(eval (cons (if print.supressed
                                         lambda-last
                                         print.original)
                                         (args)))))

(constant 'println (lambda-macro()(eval (cons (if println.supressed
                                                  lambda-last
                                                  println.original)
                                             (args)))))
                                             

; Redefined print can be combined with "device" expression.

Note: in new version, one should use [print.supressed] and [println.supressed] instead of print.supressed and println.supressed.


--