def accumulate(op, initial, sequence):
    return (initial if is_none(sequence)
            else op(head(sequence),
                    accumulate(op, initial, tail(sequence))))
def horner_eval(x, coefficient_sequence):
    return accumulate(lambda this_coeff, higher_terms:
                      x * higher_terms + this_coeff,
                      0,
                      coefficient_sequence)

print(horner_eval(2, llist(1, 3, 0, 5, 0, 1)))

# expected: 79
