<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 29, 2014 at 11:04 AM, Chris Muller <span dir="ltr">&lt;<a href="mailto:asqueaker@gmail.com" target="_blank">asqueaker@gmail.com</a>&gt;</span> wrote:<br><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I&#39;ve never regarded collect as a mapping function, only a<br>
transformation function. <br></blockquote><div><br></div><div>Yeah, I agree. I think the important features of #collect: are that (a) the result is the same type of collection as the original, and (b) the result contains all the the objects returned from the block. If the semantics of that particular collection lead to the result being a different size from the original, that&#39;s fine. It&#39;s also fine if there&#39;s no implicit mapping from the original to the result; if you need such a mapping, build a Dictionary, or at least a collection of Associations, as Chris suggests.</div><div><br></div><div>Keeping it simple will make it easy to predict what the particular behaviour of any #collect: implementation will be. </div><div><br></div><div>Colin</div><div><br></div></div></div></div>