close Warning: Can't synchronize with repository "(default)" (The repository directory has changed, you should resynchronize the repository with: trac-admin $ENV repository resync '(default)'). Look in the Trac log for more information.

Ignore:
Timestamp:
2016-06-10T09:50:24-07:00 (8 years ago)
Author:
Marek Rychlik
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/f4grobner/infix-printer.lisp

    r4423 r4434  
    4444(defun inverse-op (op)
    4545  (ecase op
     46    (+ '-)
    4647    (- '+)
     48    (* '/)
    4749    (/ '*)))
    4850
     
    5355                                     (beg t)
    5456                                     (count 0)
    55                                      true-sep)
     57                                     true-sep
     58                                     more-args)
    5659  "Print a list LST using SEP as separator, to stream STREAM. Every
    5760argument is printed usin OP as main operator. PRINT-LEVEL is used to
     
    8790                 (> count 1)
    8891                 (consp arg)
    89                  (endp (cddr arg))
    9092                 (eq alt-op (car arg)))
    9193        (psetf arg (cadr arg)
    92                true-sep (if (eq op alt-op) (inverse-op op) alt-op)))
    93        
     94               more-args (cddr arg))
     95        (cond ((endp more-args)
     96               (setf true-sep (if (eq op alt-op) (inverse-op op) alt-op)))))
     97
     98
    9499      ;; Unless at the beginning, print the separator
    95100      (cond
     
    106111      (infix-print-to-stream arg stream op print-level)
    107112
     113      ;; Print remaining arguments
     114      (unless (endp more-args)
     115        (let ((x-op (inverse-op op)))
     116          (format stream "~a" x-op)
     117          (infix-print-separated-list more-args x-op stream sep print-level x-op)))
    108118      )))
    109119  (values))
Note: See TracChangeset for help on using the changeset viewer.