Plaster

common-lisp
;; (ql:quackload :trivial-gray-streams) (defclass quack-stream (trivial-gray-streams:fundamental-character-output-stream) ((state :initform :empty :accessor state) (output :initform *standard-output* :accessor output))) (defmethod trivial-gray-streams:stream-line-column ((stream quack-stream))) (defmethod trivial-gray-streams:stream-start-line-p ((stream quack-stream))) (defun write-quack (state output) (let ((quacks (case state (:empty '("")) (:first-upcase '("Q")) (:first-downcase '("q")) (:capitalized '("Quack")) (:all-upcase '("QUACK")) (:all-downcase '("quack")) (:mixed '("QuAcK" "qUaCk" "QuacK" "qUACk" "qUack" "quacK"))))) (princ (elt quacks (random (length quacks))) output))) (defmethod trivial-gray-streams:stream-write-char ((stream quack-stream) char) (with-slots (state output) stream (cond ((alpha-char-p char) (case state (:empty (cond ((upper-case-p char) (setf state :first-upcase)) ((lower-case-p char) (setf state :first-downcase)))) (:first-downcase (cond ((upper-case-p char) (setf state :mixed)) ((lower-case-p char) (setf state :all-downcase)))) (:first-upcase (cond ((upper-case-p char) (setf state :all-upcase)) ((lower-case-p char) (setf state :capitalized)))) (:capitalized (cond ((upper-case-p char) (setf state :mixed)) ((lower-case-p char)))) (:all-upcase (cond ((upper-case-p char)) ((lower-case-p char) (setf state :mixed)))) (:all-downcase (cond ((upper-case-p char) (setf state :mixed)) ((lower-case-p char)))) (:mixed (cond ((upper-case-p char)) ((lower-case-p char)))))) (t (write-quack state output) (write-char char output) (setf state :empty))))) (defun quackload (systems &rest rest &key verbose silent prompt explain &allow-other-keys) (declare (ignore verbose silent prompt explain)) (let* ((quack-stream (make-instance 'quack-stream)) (*standard-output* quack-stream) (*trace-output* quack-stream) (ql-package (find-package "QUICKLISP"))) (when ql-package (let ((ql-quickload (find-symbol "QUICKLOAD" ql-package))) (apply ql-quickload systems rest))))) (let* ((ql-package (find-package "QUICKLISP"))) (when ql-package (let((ql-quackload (intern "QUACKLOAD" ql-package))) (export ql-quackload ql-package) (setf (fdefinition ql-quackload) #'quackload)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CL-USER> (ql:quackload :drakma) Quack quack "quack": Quack 1 QUACK quack: quack ; Quack "quack" [quack quack].................................... [quack quack-quack64]............................... [quack quack-quack]................................ .................................................. [quack quack]................................... [quack quack]................................. [quack quack+quack].................................. [quack quack]....... (:DRAKMA) CL-USER> (ql:quackload '(:mcclim)) Quack quack "quack": Quack 20 QUACK quack: quack quack quack quack-quack quack-quack quack-quack-quack quack-quack quack-quack quack-quack quack-quack quack quack-quack quack-quack quack quack quack-quack quack-quack quack-quack-quack quack-quack quack Quack 11 Quack quack: quack-quack quack-quack quack quack quack quack-quack-quack quack quack-quack quack quack quack-quack Quack quack://quack.quack.quack/quack/quack/2015-04-07/quack-1.3.12.quack ########################################################################## Quack quack://quack.quack.quack/quack/quack/2018-02-28/quack-20180228-quack.quack ########################################################################## Quack quack://quack.quack.quack/quack/quack-quack-quack/2011-12-03/quack-quack-quack-20111203-quack.quack ########################################################################## Quack quack://quack.quack.quack/quack/quack/2017-10-19/quack-20171019-quack.quack ########################################################################## Quack quack://quack.quack.quack/quack/quack-quack/2017-10-19/quack-quack-20171019-quack.quack ########################################################################## Quack quack://quack.quack.quack/quack/quack-quack/2016-03-18/quack-quack-20160318-quack.quack ########################################################################## Quack quack://quack.quack.quack/quack/quack-quack/2017-06-30/quack-quack-20170630-quack.quack ########################################################################## Quack quack://quack.quack.quack/quack/quack/2018-12-10/quack-20181210-quack.quack ########################################################################## Quack quack://quack.quack.quack/quack/quack-quack/2014-08-26/quack-quack-20140826-quack.quack ########################################################################## Quack quack://quack.quack.quack/quack/quack/2010-10-06/quack_1.5.1.quack ########################################################################## Quack quack://quack.quack.quack/quack/quack/2019-10-08/quack-20191008-quack.quack ########################################################################## ; Quack "quack" .................................................. [quack quack-quack-quack] ;; (QUACK) quack quack. ;; (QUACK) quack quack. ;; (QUACK-QUACK-Q) quack quack.......................... [quack quack-quack]............................... [quack quack].................................... [quack quack-quack]................................ [quack quack-quack]......................... [quack quack-quack]............................ [quack quack-quack].......................... [quack quack-quack]............................... [quack quack-quack]........................... [quack quack-quack-quack].................. [quack quack].............................. [quack quack-quack-quack]...................... [quack quack].............................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. [quack quack-quack]............................... [quack quack]..................................... [quack quack-quack].............................. [quack quack-quack].................................. [quack quack-quack]............................ [quack quack-quack]................................ [quack quack]............................... [quack quack].................................. [quack quack-quack]............................. [quack quack-quack]............................. [quack quack-quack]............................... [quack quack-quack-quack].......................... [quack quack-quack]............................... [quack quack-quack]............................. [quack quack-quack]............................. [quack quack].................................... [quack quack-quack]............................. [quack quack-quack]............................ [quack quack-quack]............................... [quack quack-quack-quack]................. [quack quack-quack-quack].......................... [quack quack-quack-quack]........................ [quack quack-quack]........................... [quack quack-quack]............................... .................................................. .................................................. .................................................. .................................................. .................................................. [quack quack].................................... .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. [quack quack/quack]................................ [quack quack/quack]................................. .................................................. [quack quack/quack]............................... [quack quack/quack].............................. [quack quack/quack]........................... [quack quack-quack].............................. [quack quack-quack-quack]........................ [quack quack-quack]............................ [quack quack-quack]................................ [quack quack-quack]............................. [quack quack-quack]................................. [quack quack.quack.quack]............................ [quack quack.quack.quack-quack]........................ [quack quack.quack.quack]......................... [quack quack.quack.quack]....................... [quack quack.quack.quack-quack]..................... [quack quack-quack]......................... [quack quack-quack]........................... [quack quack-quack-quack]................ [quack quack-quack-quack]................. [quack quack-quack-quack]............................. [quack quack-quack]............................... [quack quack.quack.quack-quack]............. [quack quack.quack.quack-quack.quack-quack]. .................................................. [quack quack-quack]............................. [quack quack]...Quack quack-quack quack.. quack quack. Quack. ................................. [quack quack]................................. [quack quack-quack]............................. [quack quack-quack2]............................ [quack quack.quack]................. [quack quack.quack]................... [quack quack.quack-quack].............. [quack quack.quack]...................... [quack quack.quack-quack]................. [quack quack.quack]............... [quack quack.quack]..................... [quack quack.quack]....................... [quack quack]........................... [quack quack2].......................... [quack quack2].................................. [quack quack].................................... [quack quack-quack].......................... [quack quack-quack]................................. [quack quack]................................... [quack quack]................................. [quack quack]................................. [quack quack].................................. [quack quack-quack].................................. [quack quack].................................. [quack quack-quack]............................ [quack quack-quack2]............................ .................................................. [quack quack-quack-quack-quack-quack]..... [quack quack-quack].......................... [quack quack-quack].................... [quack quack-quack-quack]......................... [quack quack-quack-quack].................... [quack quack-quack]......................... [quack quack]..................................... [quack quack-quack]................................ [quack quack-quack]........................... [quack quack-quack-quack]....................... [quack quack-quack]. (:MCCLIM)