From: Rick DeNatale on 1 Aug 2010 12:49 On Sun, Aug 1, 2010 at 12:45 PM, Rick DeNatale <rick.denatale(a)gmail.com> wrote: >> >> def all!?(&block) >> !empty? && all?(&block) >> end > > No that doesn't make sense to me all not? Not at all! > > All not what? And right after I hit send, I realized that I'd probably expect semantics more like: #def all!? def all_not? if block_given? all? {|element| ! yield element} else all? {|element| ! element} end end -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale
From: Hal Fulton on 1 Aug 2010 13:24 [Note: parts of this message were removed to make it a legal post.] On Sun, Aug 1, 2010 at 11:46 AM, Rick DeNatale <rick.denatale(a)gmail.com>wrote: > On Sun, Aug 1, 2010 at 12:28 PM, Maurizio De Santis > <desantis.maurizio(a)gmail.com> wrote: > > Josh Cheek wrote: > >> On Fri, Jul 30, 2010 at 10:49 AM, Rick DeNatale > >> <rick.denatale(a)gmail.com>wrote: > >> > >>> [].all? {|element| element != 3 } # => true > >>> There may be a better name than non_vacuous_all? but I can't think of > one. > >>> > >>> > >> How about #appall? to imply that it is a pessimistic implementation of > >> #all? > >> :) > Ho
From: Hal Fulton on 1 Aug 2010 13:25 [Note: parts of this message were removed to make it a legal post.] On Sun, Aug 1, 2010 at 12:24 PM, Hal Fulton <rubyhacker(a)gmail.com> wrote: > On Sun, Aug 1, 2010 at 11:46 AM, Rick DeNatale <rick.denatale(a)gmail.com>wrote: > >> On Sun, Aug 1, 2010 at 12:28 PM, Maurizio De Santis >> <desantis.maurizio(a)gmail.com> wrote: >> > Josh Cheek wrote: >> >> On Fri, Jul 30, 2010 at 10:49 AM, Rick DeNatale >> >> <rick.denatale(a)gmail.com>wrote: >> >> >> >>> [].all? {|element| element != 3 } # => true >> >>> There may be a better name than non_vacuous_all? but I can't think of >> one. >> >>> >> >>> >> >> How about #appall? to imply that it is a pessimistic implementation of >> >> #all? >> >> :) >> > > Sorry, hit send by accident. How about 'every?' for the non-vacuous 'all?'? If we really need one, that is. Hal
From: David A. Black on 1 Aug 2010 13:48 Hi -- On Mon, 2 Aug 2010, Hal Fulton wrote: > On Sun, Aug 1, 2010 at 12:24 PM, Hal Fulton <rubyhacker(a)gmail.com> wrote: > >> On Sun, Aug 1, 2010 at 11:46 AM, Rick DeNatale <rick.denatale(a)gmail.com>wrote: >> >>> On Sun, Aug 1, 2010 at 12:28 PM, Maurizio De Santis >>> <desantis.maurizio(a)gmail.com> wrote: >>>> Josh Cheek wrote: >>>>> On Fri, Jul 30, 2010 at 10:49 AM, Rick DeNatale >>>>> <rick.denatale(a)gmail.com>wrote: >>>>> >>>>>> [].all? {|element| element != 3 } # => true >>>>>> There may be a better name than non_vacuous_all? but I can't think of >>> one. >>>>>> >>>>>> >>>>> How about #appall? to imply that it is a pessimistic implementation of >>>>> #all? >>>>> :) >>> >> >> > Sorry, hit send by accident. > > How about 'every?' for the non-vacuous 'all?'? > > If we really need one, that is. Or maybe "all?!" :-) David -- David A. Black, Senior Developer, Cyrus Innovation Inc. The Ruby training with Black/Brown/McAnally Compleat Philadelphia, PA, October 1-2, 2010 Rubyist http://www.compleatrubyist.com
From: Maurizio De Santis on 2 Aug 2010 17:02 what about "all_and_not_empty" ? or maybe: "all_and_when_I_say_all_I_say_all!" :D -- Posted via http://www.ruby-forum.com/.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: binary encode 7 ([7].pack("C")) as "\007" instead of "\a" Next: leak tracking x64 |