impc:ti:math-check   scheme


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

Implementation

(define impc:ti:math-check
  (lambda (ast vars kts request?)
    ;; cleanup request!
    (if (and (list? request?) (= 1 (length request?))) (set! request? (car request?)))
    ;; if request? is notype - make false
    (if (equal? request? *impc:ir:notype*) (set! request? #f))
    ;; if request is false
    (if (not request?)
        (begin (if (member (cadr ast) kts) (set! request? (cdr (assoc-strcmp (cadr ast) vars))))
               (if (member (caddr ast) kts) (set! request? (cdr (assoc-strcmp (caddr ast) vars))))))
    ;; now start type checking
    (let* ((n1 (cadr ast))
           (n2 (caddr ast))
           (a (impc:ti:type-unify (impc:ti:type-check n1 vars kts request?) vars))
           (b (impc:ti:type-unify (impc:ti:type-check n2 vars kts request?) vars))
           (t (impc:ti:type-unify (cl:remove #f (list (if (null? a) #f a) (if (null? b) #f b))) vars)))
      (if (equal? a #f) (set! a '()))
      (if (equal? b #f) (set! b '()))
      ;; (println 'math: 'a a 'b b 't t 'r request? 'ast: ast *math-recursion-check-depth*)


Back to Index