(define impc:ti:type-unify-closure
(lambda (t vars)
;; (println 'cls: t (flatten-1 t))
(if (or (null? t)
(not (list? (car t))))
t
(let* ((t1 (flatten-1 t))
(lgth (length (car t1)))
(t2 (cl:remove-if (lambda (x) (or (atom? x)
(<> (length x) lgth)))
t1))
(p2 (map (lambda (i)
;; (println 'i i)
(map (lambda (x)
;; (println 'x x)
(list-ref x i))
t2))
(range 1 lgth)))
(p3 (map (lambda (x) (impc:ti:type-unify (cl:remove-duplicates x) vars)) p2))
(p4 (cons 213 p3)))
;; (println 'p2 p2 'p3 p3 'p4 p4 't t)
(set! p4 '())
(if (null? p4) t2 p4)))))