WIP: BaseRecurrent and recurrent_apply_method

The scan related code is a typical boilerplate code
of which we had so much in Groundhog. This commit
introduces a way to get rid of it: a decorator that adds iteration
code to a single-step transition function.
Hmm... I don't know how to do this with list comprehensions in one line.

On 22.10.2014 19:37, Bart van Merriënboer wrote:
>
> In blocks/bricks.py:
>
> > +        states : list of str or (str, function) tuples.
> > +            Names of transition function arguments that
> > +            play state role. Additionaly a state initialization
> > +            function can be passed. The function should take
> > +            `self` and the batch sizes as arguments. By
> > +            default `BaseRecurrent.zero_state` is used.
> > +        num_outputs : int
> > +            Number of outputs of the transition function.
> > +        """
> > +
> > +        # Take care of default initialization.
> > +        for i in range(len(states)):
> > +            if isinstance(states[i], str):
> > +                states[i] = (states[i], BaseRecurrent.zero_state)
> > +
> > +        states, state_init_funcs = map(list, zip(*states))
>
> The most "Pythonic" way would probably be to use a list comprehension 
> instead of |map|.
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/bartvm/blocks/pull/10/files#r19230127>.
>