(define impc:ti:allocate-var?
(lambda (ast)
(cond ((null? ast) 0)
((member ast '(lambda lambdaz)) 3)
((eq? ast 'lambdah) 1)
((eq? ast 'lambdas) 2)
((pair? ast)
(let ((a (impc:ti:allocate-var? (car ast)))
(b (impc:ti:allocate-var? (cdr ast))))
(if (> a b) a b)))
(else 0))))