(define impc:ti:minimize-gen-type-x
(lambda (l1 newl1 l2 newl2)
; (println 'l1 l1 'nl1 newl1 'l2 l2 'nlw newl2)
(if (string? l2) (set! l2 (impc:ti:get-generic-type-as-tuple l2)))
(if (null? l1)
(cons (reverse newl1) (reverse newl2))
(if (list? (car l1))
(let ((res (impc:ti:minimize-gen-type-x (car l1) '() (car l2) '())))
(impc:ti:minimize-gen-type-x
(cdr l1) (append (car res) newl1)
(cdr l2) (append (cdr res) newl2)))
(if (and (symbol? (car l1))
(regex:match? (symbol->string (car l1)) "^!"))
(impc:ti:minimize-gen-type-x (cdr l1) (cons (car l1) newl1)
(cdr l2) (cons (car l2) newl2))
(impc:ti:minimize-gen-type-x (cdr l1) newl1
(cdr l2) newl2))))))