Implement Recurrence Over a Layer

I assume that using a for loop would really slow things down. Is there any wrapper that would do something similar?