<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: map code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 29 Aug 2008 23:06:03 GMT</pubDate>
    <description>DZone Snippets: map code</description>
    <item>
      <title>In-place map_with_index</title>
      <link>http://snippets.dzone.com/posts/show/5119</link>
      <description>// This code is similar to Enumerable#map, but like each_with_index, it also yields the index of the current element.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class Array&lt;br /&gt;    def map_with_index!&lt;br /&gt;       each_with_index do |e, idx| self[idx] = yield(e, idx); end&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;    def map_with_index(&amp;block)&lt;br /&gt;        dup.map_with_index!(&amp;block)&lt;br /&gt;    end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 08 Feb 2008 10:29:44 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5119</guid>
      <author>vinterbleg (Simon Ask Ulsnes)</author>
    </item>
  </channel>
</rss>
