impc:ti:binary-arity   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/llvmti.xtm

Implementation

;; replace (* 2 3 4 5) or (+ 2 3 4 5)
;; with (* 2 (* 3 (* 4 5))) etc..
(define impc:ti:binary-arity
  (lambda (ast inbody?)
    (let ((op (car ast))
          (inlst (reverse (cdr ast))))
      (let loop ((rest (cdr inlst))
                 (lst (car inlst)))
        (if (null? rest) lst
            (loop (cdr rest) (cons op (cons (impc:ti:first-transform (car rest) inbody?) (list lst)))))))))


Back to Index

Similar Entries