In article <20041020180532.GA1126 / miya.intranet.ntecs.de>,
Michael Neumann  <mneumann / ntecs.de> wrote:
>Hi,
>
>I know we had a similar thread in the past about first/last-element
>detection.
>
>In Smalltalk there's #do:separateBy: which basically works like
>each+join combined, but in an imperative fashion.
>
>Now I tried to implement:
>
>  [1,2,3].separate_by { puts "-" }.each {|obj| 
>    puts obj
>  }
>
>desired output:
>
>  1
>  -
>  2
>  -
>  3
>

Well, it's not exactly the general-purpose solution you're looking for, 
but I would do it like this:

[1,2,3].join("\n-\n").each {|i| puts i }

1
-
2
-
3


Phil