t:elts?   scheme


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

Implementation

;; how many elements (or args for closure) does type have
;;
(define t:elts? (lambda (x num)
                  (if (string? x) (set! x (impc:ir:get-type-from-pretty-str x)))
                  (cond ((string? x) (= num -1))
                        ((or (t:array? x) (t:vector? x))
                         (= (cadr x) num))
                        ((t:tuple? x)
                         (= (- (length x) 1) num))
                        ((t:closure? x)
                         (= (- (length x) 2) num))
                        (else (= num 1)))))


Back to Index