Changeset 36 in CGBLisp
- Timestamp:
- Feb 1, 2009, 11:01:15 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/infix-printer.lisp
r35 r36 15 15 16 16 (in-package "INFIX-PRINTER") 17 18 19 20 (defun infix-print-separated-list (lst sep stream op print-level 21 &optional (alt-op nil) (alt-sep alt-op) 22 &aux 23 (beg t) 24 (count 0) 25 true-sep) 26 (cond 27 ((endp lst) nil) 28 ((and (numberp *print-level*) (> print-level *print-level*)) 29 (format stream "#")) 30 (t 31 (dolist (arg lst) 32 (setf true-sep sep) 33 (incf count) 34 (when (and alt-op (> count 1) (consp arg) (eq alt-op (car arg))) 35 (setf arg (cadr arg) 36 true-sep alt-sep)) 37 (if beg 38 (setf beg nil) 39 (format stream "~a" true-sep)) 40 (when (and (numberp *print-length*) (> count *print-length*)) 41 (format stream "..." true-sep) 42 (return-from infix-print-separated-list)) 43 (infix-print arg stream op print-level))))) 44 17 45 18 46 (defun infix-print (expr &optional (stream t) (op nil) (print-level 0)) … … 69 97 (infix-print-separated-list (cdr expr) '\, stream '\, (1+ print-level)) 70 98 (format stream ")")))))))) 71 72 (defun infix-print-separated-list (lst sep stream op print-level73 &optional (alt-op nil) (alt-sep alt-op)74 &aux75 (beg t)76 (count 0)77 true-sep)78 (cond79 ((endp lst) nil)80 ((and (numberp *print-level*) (> print-level *print-level*))81 (format stream "#"))82 (t83 (dolist (arg lst)84 (setf true-sep sep)85 (incf count)86 (when (and alt-op (> count 1) (consp arg) (eq alt-op (car arg)))87 (setf arg (cadr arg)88 true-sep alt-sep))89 (if beg90 (setf beg nil)91 (format stream "~a" true-sep))92 (when (and (numberp *print-length*) (> count *print-length*))93 (format stream "..." true-sep)94 (return-from infix-print-separated-list))95 (infix-print arg stream op print-level)))))96 97
Note:
See TracChangeset
for help on using the changeset viewer.