From: "Mauricio Fernández" Date: 2004-01-15T01:16:20+09:00 Subject: [OT] Re: collect! and Enumerable On Thu, Jan 15, 2004 at 01:11:41AM +0900, Robert Klemme wrote: > > Does collect! (or map!) make sense for Enumerables? Keep in mind that > > collect! (aka map!) is defined in Array. > > I guess you could define it as > > module Enumerable > > def collect!(&b) > > to_a.collect!(&b) > > end > > end > > but I don't feel too bad about having to do to_a explicitly. > > Especially since your definition of collect! would defy users' > expectations that it would do it in place while it really creates a copy. > :-) that's why "Does collect! (or map!) make sense for Enumerables?", but you expressed it so much better ;-) -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com And Bruce is effectively building BruceIX -- Alan Cox