[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: reusing the result of previous iteration step for comparison

Logan Capaldo

8/25/2007 3:16:00 PM

On 8/25/07, Tammo Tjarks <tammo@tammo-tjarks.de> wrote:
> I have the general the following kind of problem. I want to check somethin
> which has to hold for the whole collection. I need it for the selection comand.
> Simplified it is something like that
>
> a = { "tst1" => [[1,0],[0,1]], "tst2" => [[0,0],[1,1]], "tst3" => [[0,0],[1,1]]}
> a.select {|elemkey,elemattr|
> equal = true
> elemattr.each {|v| equal = equal && (v[0]==v[1])}
> equal == true
> }
>
> That works so far, but I think it is not a nice solution. Because I use the
> fact, that I use the variable equal which is defined outside the each-block.
> I am even unsure if that will work anymore with the next ruby-versions (1.9).
> Is there a solution only working with variables
> inside the each block? I would prefer a solution with:
> a = { "tst1" => [[1,0],[0,1]], "tst2" => [[0,0],[1,1]], "tst3" => [[0,0],[1,1]]}
> a.select {|elemkey,elemattr|
> equal = elemattr.each {|v| ????????}
> }
>
a.select { |elemkey, elemattr| elemattr.all? { |v| v[0] == v[1] } }

>
> Regards,
> Tammo
>
>
>

6 Answers

Tammo Tjarks

8/25/2007 3:38:00 PM

0

Thank you very match,
that helps.

Regards,
Tammo

Logan Capaldo wrote:

> On 8/25/07, Tammo Tjarks <tammo@tammo-tjarks.de> wrote:
>> I have the general the following kind of problem. I want to check
>> somethin which has to hold for the whole collection. I need it for the
>> selection comand. Simplified it is something like that
>>
>> a = { "tst1" => [[1,0],[0,1]], "tst2" => [[0,0],[1,1]], "tst3" =>
>> [[0,0],[1,1]]} a.select {|elemkey,elemattr|
>> equal = true
>> elemattr.each {|v| equal = equal && (v[0]==v[1])}
>> equal == true
>> }
>>
>> That works so far, but I think it is not a nice solution. Because I use
>> the fact, that I use the variable equal which is defined outside the
>> each-block. I am even unsure if that will work anymore with the next
>> ruby-versions (1.9). Is there a solution only working with variables
>> inside the each block? I would prefer a solution with:
>> a = { "tst1" => [[1,0],[0,1]], "tst2" => [[0,0],[1,1]], "tst3" =>
>> [[0,0],[1,1]]} a.select {|elemkey,elemattr|
>> equal = elemattr.each {|v| ????????}
>> }
>>
> a.select { |elemkey, elemattr| elemattr.all? { |v| v[0] == v[1] } }
>
>>
>> Regards,
>> Tammo
>>
>>
>>

Anim8rFSK

11/14/2012 2:21:00 PM

0

In article
<215203af-09bc-4313-8338-025be6aac92b@3g2000yqn.googlegroups.com>,
Remysun <remysun2000@yahoo.com> wrote:

> On Nov 12, 10:58?pm, Rich <n...@nowhere.com> wrote:
> > That "camera follows them around" crap has existed since M.A.S.H. did it.
> > It's garbage. ?The ep. was horrible.
>
> It felt like that's where the Detroit 187 crew went.

And how many cameras were supposed to be IN that crew, anyway? In the
murder scene in the trailer, they were cutting between at least 4
different angles. Rich is right on this one.

--
"Every time a Kardashian gets a TV show, an angel dies."

Remysun

11/14/2012 4:34:00 PM

0

On Nov 14, 9:20 am, anim8rFSK <anim8r...@cox.net> wrote:

> And how many cameras were supposed to be IN that crew, anyway?  In the
> murder scene in the trailer, they were cutting between at least 4
> different angles.  Rich is right on this one.

Another group that I frequent would say that 4 cameras is SOP. Of
course, that makes the ending pointless, unless Beckett had four
closets, not to mention, who still had the tape?

Adam H. Kerman

11/14/2012 4:36:00 PM

0

anim8rFSK <anim8rfsk@cox.net> wrote:
>Remysun <remysun2000@yahoo.com> wrote:
>>On Nov 12, 10:58 pm, Rich <n...@nowhere.com> wrote:

>>>That "camera follows them around" crap has existed since M.A.S.H. did it.
>>>It's garbage. The ep. was horrible.

>>It felt like that's where the Detroit 187 crew went.

>And how many cameras were supposed to be IN that crew, anyway? In the
>murder scene in the trailer, they were cutting between at least 4
>different angles. Rich is right on this one.

I'm glad I'm not the only one that bothered.

Anim8rFSK

11/14/2012 7:48:00 PM

0

In article <k80h90$2or$3@news.albasani.net>,
"Adam H. Kerman" <ahk@chinet.com> wrote:

> anim8rFSK <anim8rfsk@cox.net> wrote:
> >Remysun <remysun2000@yahoo.com> wrote:
> >>On Nov 12, 10:58 pm, Rich <n...@nowhere.com> wrote:
>
> >>>That "camera follows them around" crap has existed since M.A.S.H. did it.
> >>>It's garbage. The ep. was horrible.
>
> >>It felt like that's where the Detroit 187 crew went.
>
> >And how many cameras were supposed to be IN that crew, anyway? In the
> >murder scene in the trailer, they were cutting between at least 4
> >different angles. Rich is right on this one.
>
> I'm glad I'm not the only one that bothered.

I kept thinking they were cutting between the show and the show within a
show, but Castle looked in every camera, so then I was thinking it was
edited footage, but the dialog was continuous so ... it was just
glaringly stupid.

--
"Every time a Kardashian gets a TV show, an angel dies."

Anim8rFSK

11/14/2012 7:49:00 PM

0

In article
<559e4d8c-3dc2-4315-b95e-e8094eef3d0c@h9g2000yqd.googlegroups.com>,
Remysun <remysun2000@yahoo.com> wrote:

> On Nov 14, 9:20?am, anim8rFSK <anim8r...@cox.net> wrote:
>
> > And how many cameras were supposed to be IN that crew, anyway? ?In the
> > murder scene in the trailer, they were cutting between at least 4
> > different angles. ?Rich is right on this one.
>
> Another group that I frequent would say that 4 cameras is SOP. Of
> course, that makes the ending pointless, unless Beckett had four
> closets, not to mention, who still had the tape?

The problem is, they were in a trailer. 4 camera crews, side by side,
in a trailer murder scene, shooting a bunch of cops??

--
"Every time a Kardashian gets a TV show, an angel dies."