def bounce(sequence):
 N = len(sequence)
 def f(i):
  (div, mod) = divmod(i, N)
  if ((div % 2) == 0):
   return sequence[mod]
  else:
   return sequence[((N - mod) - 1)]
 return partial(_force, sequence=_advance(f))

def bounce ( sequence ) : N = len ( sequence ) def f ( i ) : ( div , mod ) = divmod ( i , N ) if ( ( div % 2 ) == 0 ) : return sequence [ mod ] else : return sequence [ ( ( N - mod ) - 1 ) ] return partial ( _force , sequence = _advance ( f ) )
return a driver function that can advance a "bounced" sequence of values .