scan is used for calling function multiple times over a list of values, the function may contain state.
scan syntax (as of theano 0.9):
scan(
    fn,
    sequences=None,
    outputs_info=None,
    non_sequences=None,
    n_steps=None,
    truncate_gradient=-1,
    go_backwards=False,
    m...