(and (pair? ls)
(let ((op (car ls))
(ls (cdr ls)))
- (if (null? ls)
- (list op x)
+ (if (and (pair? ls) (null? (cdr ls)))
+ (cons* op x ls)
(let ((tail (extract-infix-list ls)))
(and tail
- (equal? op (car tail))
+ (equal? (strip-annotation op)
+ (strip-annotation (car tail)))
(cons* op x (cdr tail))))))))))
(cond
- ((or (not (eqv? rdelim #\}))) ret) ; Only on {...} lists.
- ((null? ret) ret) ; {} => ()
- ((null? (cdr ret)) (car ret)) ; {x} => x
- ((null? (cddr ret)) ret) ; {x y} => (x y)
+ ((not (eqv? rdelim #\})) ret) ; Only on {...} lists.
+ ((not (pair? ret)) ret) ; {} => ()
+ ((not (pair? (cdr ret))) (car ret)); {x} => x
+ ((not (pair? (cddr ret))) ret) ; {x y} => (x y)
((extract-infix-list ret)) ; {x + y + ... + z} => (+ x y ... z)
(else (cons '$nfx$ ret)))) ; {x y . z} => ($nfx$ x y . z)
(define curly? (eqv? rdelim #\}))