horner-eval
count-leaves using accumulation