Paste number 76434: the logging thing - my work-around - i just wanted to solve the problem (still will look at what drewc directed me to)

Paste number 76434: the logging thing - my work-around - i just wanted to solve the problem (still will look at what drewc directed me to)
Pasted by: trebor_home
When:1 year, 6 months ago
Share:Tweet this! | http://paste.lisp.org/+1MZ6
Channel:#lisp
Paste contents:
Raw Source | XML | Display As
(defun rgl-sprint (printlist)
  "work-around to use streams as last argument --- UGLY but working"
  (let* ((restlist (reverse (rest (reverse printlist))))
	 (maybe-stream (first (last (first (last printlist))))));;to-be-done-better
    (if (streamp maybe-stream)
	(print restlist maybe-stream)
	(print printlist))))




(defmacro rgl-print-symbols (&rest symbols)
  "generate a (print (list 'symbol1 symbol1 .....) using rgl-zprint as a work-around"
  (let ((printlist
	 (loop 
	    for symbol in symbols
	    collect (list `list `',symbol `,symbol ))))
    `(rgl-sprint (list ,@printlist))))




(defun test---rgl-print-symbols ()
  "now using streams as supposed to, ugly but working"
  (let ((a "hello") (b "hello2"))
    (with-open-file (file "test.txt"
			  :direction :output
			  :if-exists :append
			  :if-does-not-exist :create)
      (rgl-print-symbols a b file)
      (print (macroexpand-1 '(rgl-print-symbols a b file))))))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.