Helper method with block--with list iteration?

I’d like to use the helper method with block technique, but I can’t seem
to make it work the way I want with a list. I’m imagining something like

<% decorate_list_with_max(list, 5) do |item| %>
Here’s the item name: <%= %>
<% end %>

decorate_list_with_max(list, max, &block) {
output = “”
index = 0;
list.each |item|
output << “Before item”;
output << capture(item, &block)
output << “After item”;
index = index + 1
break if index > max

I think you get the idea? My helper gets a list, iterates over it
passing to the block in the view on each iteration (and passing an
argument to the block), with full control of the logic of the iteration,
including stopping it in the middle, etc.

It seems like there ought to be a way to do this. But I’m not succeeding
in making it work. Anyone done something like this before?

Oh, Rails 1.8.x, not 2 yet.