def enqueue(reindeer): """ >>> list(p.take(6, enqueue(('Vixen', 8, 2, 2)))) [8, 16, 16, 16, 24, 32] """ _, speed, running, resting = reindeer one_cycle = it.chain(it.repeat(speed, running), it.repeat(0, resting)) return p.drop(1, p.scan(operator.add, it.cycle(one_cycle), 0))
def get_passwords(string): """ >>> next(get_passwords('abcdefgh')) 'abcdffaa' >> next(get_passwords('ghijklmn')) 'ghjaabcc' """ seq = p.drop(1, p.iterate(inc_string, string)) passwords = filter(meets_reqs, seq) return passwords
def make_pairs(seating): """ >>> list(make_pairs([1,2,3])) [(1, 2), (2, 3)] """ return zip(seating, p.drop(1, seating))