(defun rw-rows (headings in out) "
(rw-rows headings in out)
peeks for eof before doing #'rw-each
"
(let ((peek1 (peek-char t in nil nil))
(peek2 (peek-char nil in nil nil)))
(when peek2
(rw-each (copy-list headings) in out)
(rw-rows headings in out))))
;;;An alist like
;;;(("string" . (lambda (&optional in out) 'foo)))
(setq *assoclosures*
(list
(cons "this"
(let ((last-val nil))
(lambda (&optional in out)
(if (and in out)
(format out "\"~a:~a\" " "this"
(setf last-val (read in)))
last-val))))
(cons "that"
(let ((last-val nil))
(lambda (&optional in out)
(if (and in out)
(format out "\"~a:~a\" " "that"
(setf last-val (read in)))
last-val))))
(cons "the"
(let ((last-val nil))
(lambda (&optional in out)
(if (and in out)
(format out "\"~a:~a\" " "the"
(setf last-val (read in)))
last-val))))
(cons "other"
(let ((last-val nil))
(lambda (&optional in out)
(if (and in out)
(format out "\"~a:~a\" " "other"
(setf last-val (read in nil nil)))
last-val))))
(cons "rowsum"
(let ((last-val nil))
(lambda (&optional in out)
(if (and in out)
(format out "\"~a:~a\"~%" "rowsum"
(setf last-val
(reduce '+
(mapcan (lambda (x)
(let ((n (funcall (cdr x))))
(and n (list n))))
*assoclosures*))))
last-val))))))