[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Array comparison returning nil

Nuralanur

3/3/2006 3:23:00 PM

Could it be that some of the elements in your arrays cannot be compared,
like "a" and 1 ?

You can help this by mapping all these elements to numbers or strings, which
can be sorted,
as in this example

a = ["three",3, "four",4]
c = ["ten",10,"eleven",11]
b=a.sort{ |x,y| x.to_s <=> y.to_s}<=>c.sort { |x,y| x.to_s <=> y.to_s}
puts "result is #{b}"

which gives a result -1, since 3 is smaller than 10.

Best regards,

Axel

4 Answers

Remysun

9/23/2011 11:57:00 PM

0

On Sep 23, 6:44 pm, David Barnett <dbar3...@bigpond.net.au> wrote:
> At my age (82 yesterday) I've forgotten more about The Event than I
> remember.

Unfortunately, all I remember is that it sucked.

Dragon Lady

9/24/2011 3:33:00 AM

0


"Merrick Baldelli" <mbaldelli@yahoo.com> wrote in message
news:hajp775ikp1t27jacnccgskrs3kg68sq39@4ax.com...
> On Fri, 23 Sep 2011 13:58:07 -0400, Bill Steele <ws21@cornell.edu>
> wrote:
>
>>In article <6rvo779jbea8skrdsgrb6579ssf4rp682g@4ax.com>,
>> Merrick Baldelli <mbaldelli@yahoo.com> wrote:
>>
>>> >I'm not talking about what['s good for the writers, but what's good for
>>> >the viewers, and we seem to be tossed off as irrelevant.
>>>
>>> Well of course because viewers are now viewed as a mob. The
>>> only time that Hollywood becomes concerned with the mob is when the
>>> efforts seems to be moving in unison. Most of the time however, it
>>> doesn't because the mob splinters into groups -- for, against and
>>> ambivalent -- and as a veritable hydra fights against itself. Why
>>> should they care really when the mob seems to fight amongst itself?
>>
>>Compare the number of people who a unhappy because The Event didn't wrap
>>up with the number who think that was a good thing. Then find me a
>>network exec who gives a crap about those numbers.
>
> pfft... That's how many again? According to season finally
> that was under 5 million out of the US population of more than 308
> million (2010 figures). And out of that 114.5 million home viewers
> (2009 figures according to Nielsen).
>
> Sounds like a small special interest group, where the rest of
> the mob couldn't care less whether or not the show gets a "wrap up".
> Face it -- you're a minority you're not going to get what you want no
> matter how you try to change the heads that make the decisions. And
> then get over it.

*LOL* I never thought I'd see the day when 5 million people were called a
"small special interest group"!

Bill Steele

9/27/2011 3:23:00 PM

0

In article <j5jj20$gle$1@dont-email.me>,
"Dragon Lady" <sgtsaak@comcast.net> wrote:

> "Merrick Baldelli" <mbaldelli@yahoo.com> wrote in message
> news:hajp775ikp1t27jacnccgskrs3kg68sq39@4ax.com...
> > On Fri, 23 Sep 2011 13:58:07 -0400, Bill Steele <ws21@cornell.edu>
> > wrote:
> >
> >>In article <6rvo779jbea8skrdsgrb6579ssf4rp682g@4ax.com>,
> >> Merrick Baldelli <mbaldelli@yahoo.com> wrote:
> >>
> >>> >I'm not talking about what['s good for the writers, but what's good for
> >>> >the viewers, and we seem to be tossed off as irrelevant.
> >>>
> >>> Well of course because viewers are now viewed as a mob. The
> >>> only time that Hollywood becomes concerned with the mob is when the
> >>> efforts seems to be moving in unison. Most of the time however, it
> >>> doesn't because the mob splinters into groups -- for, against and
> >>> ambivalent -- and as a veritable hydra fights against itself. Why
> >>> should they care really when the mob seems to fight amongst itself?
> >>
> >>Compare the number of people who a unhappy because The Event didn't wrap
> >>up with the number who think that was a good thing. Then find me a
> >>network exec who gives a crap about those numbers.
> >
> > pfft... That's how many again? According to season finally
> > that was under 5 million out of the US population of more than 308
> > million (2010 figures). And out of that 114.5 million home viewers
> > (2009 figures according to Nielsen).
> >
> > Sounds like a small special interest group, where the rest of
> > the mob couldn't care less whether or not the show gets a "wrap up".
> > Face it -- you're a minority you're not going to get what you want no
> > matter how you try to change the heads that make the decisions. And
> > then get over it.
>
> *LOL* I never thought I'd see the day when 5 million people were called a
> "small special interest group"!

Unfortunately, network execs are like the fox coveting grapes it can't
reach. If they think they can substitute a 6 million audience for the 5
million they'll try it. They are driven by the illusion that someday it
will be possible to have all of the audience all of the time.

Dragon Lady

9/27/2011 3:38:00 PM

0


"Bill Steele" <ws21@cornell.edu> wrote in message
news:ws21-4EA7CF.11224927092011@newsstand.cit.cornell.edu...
> In article <j5jj20$gle$1@dont-email.me>,
> "Dragon Lady" <sgtsaak@comcast.net> wrote:
>
>> "Merrick Baldelli" <mbaldelli@yahoo.com> wrote in message
>> news:hajp775ikp1t27jacnccgskrs3kg68sq39@4ax.com...
>> > On Fri, 23 Sep 2011 13:58:07 -0400, Bill Steele <ws21@cornell.edu>
>> > wrote:
>> >
>> >>In article <6rvo779jbea8skrdsgrb6579ssf4rp682g@4ax.com>,
>> >> Merrick Baldelli <mbaldelli@yahoo.com> wrote:
>> >>
>> >>> >I'm not talking about what['s good for the writers, but what's good
>> >>> >for
>> >>> >the viewers, and we seem to be tossed off as irrelevant.
>> >>>
>> >>> Well of course because viewers are now viewed as a mob. The
>> >>> only time that Hollywood becomes concerned with the mob is when the
>> >>> efforts seems to be moving in unison. Most of the time however, it
>> >>> doesn't because the mob splinters into groups -- for, against and
>> >>> ambivalent -- and as a veritable hydra fights against itself. Why
>> >>> should they care really when the mob seems to fight amongst itself?
>> >>
>> >>Compare the number of people who a unhappy because The Event didn't
>> >>wrap
>> >>up with the number who think that was a good thing. Then find me a
>> >>network exec who gives a crap about those numbers.
>> >
>> > pfft... That's how many again? According to season finally
>> > that was under 5 million out of the US population of more than 308
>> > million (2010 figures). And out of that 114.5 million home viewers
>> > (2009 figures according to Nielsen).
>> >
>> > Sounds like a small special interest group, where the rest of
>> > the mob couldn't care less whether or not the show gets a "wrap up".
>> > Face it -- you're a minority you're not going to get what you want no
>> > matter how you try to change the heads that make the decisions. And
>> > then get over it.
>>
>> *LOL* I never thought I'd see the day when 5 million people were called
>> a
>> "small special interest group"!
>
> Unfortunately, network execs are like the fox coveting grapes it can't
> reach. If they think they can substitute a 6 million audience for the 5
> million they'll try it. They are driven by the illusion that someday it
> will be possible to have all of the audience all of the time.

It's always amused me that business execs seem to forget that the goal is to
make a profit. Period. It's not to make all the profit that can possibly
be made, because that's a zero end game - once you do it, everyone else is
broke, and you can no longer make a profit at all.