[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Truncate an array

Berger, Daniel

7/26/2006 2:48:00 PM

> -----Original Message-----
> From: Aleks Kissinger [mailto:aleks0@gmail.com]
> Sent: Wednesday, July 26, 2006 8:44 AM
> To: ruby-talk ML
> Subject: Re: Truncate an array
>
>
> I'd thought about that too. This is bad for two reasons.
>
> 1. SOME_ARRAY is 'supposedly' a constant, in that ruby
> complains if you assign to it more than once.

If it's not constant, don't make it a constant.

> 2. We didn't really truncate the array, just made a new empty one.

<snip>

Ok, use Array#clear then:

irb(main):014:0> a = [1,2,3]
=> [1, 2, 3]
irb(main):015:0> b = a
=> [1, 2, 3]
irb(main):016:0> a.clear
=> []
irb(main):017:0> a
=> []
irb(main):018:0> b
=> []

Regards,

Dan


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly
prohibited and may be unlawful. If you have received this communication
in error, please immediately notify the sender by reply e-mail and destroy
all copies of the communication and any attachments.

2 Answers

Aleks Kissinger

7/26/2006 4:08:00 PM

0

ah, thats the one.

On 7/26/06, Berger, Daniel <Daniel.Berger@qwest.com> wrote:
> > -----Original Message-----
> > From: Aleks Kissinger [mailto:aleks0@gmail.com]
> > Sent: Wednesday, July 26, 2006 8:44 AM
> > To: ruby-talk ML
> > Subject: Re: Truncate an array
> >
> >
> > I'd thought about that too. This is bad for two reasons.
> >
> > 1. SOME_ARRAY is 'supposedly' a constant, in that ruby
> > complains if you assign to it more than once.
>
> If it's not constant, don't make it a constant.
>
> > 2. We didn't really truncate the array, just made a new empty one.
>
> <snip>
>
> Ok, use Array#clear then:
>
> irb(main):014:0> a = [1,2,3]
> => [1, 2, 3]
> irb(main):015:0> b = a
> => [1, 2, 3]
> irb(main):016:0> a.clear
> => []
> irb(main):017:0> a
> => []
> irb(main):018:0> b
> => []
>
> Regards,
>
> Dan
>
>
> This communication is the property of Qwest and may contain confidential or
> privileged information. Unauthorized use of this communication is strictly
> prohibited and may be unlawful. If you have received this communication
> in error, please immediately notify the sender by reply e-mail and destroy
> all copies of the communication and any attachments.
>
>

John Doe

8/13/2010 9:45:00 AM

0

On 13 Aug 2010 07:36:04 GMT, rfischer@sonic.net (Ray Fischer) wrote:

>NoBody <nobody@nowhere.com> wrote:
>>On 11 Aug 2010 07:22:53 GMT, rfischer@sonic.net (Ray Fischer) wrote:
>>
>>>NoBody <nobody@nowhere.com> wrote:
>>>> rfischer@sonic.net (Ray Fischer) wrote:
>>>>>NoBody <nobody@nowhere.com> wrote:
>>>>>> rfischer@sonic.net (Ray Fischer) wrote:
>>>>>>>NoBody <nobody@nowhere.com> wrote:
>>>>>>>> rfischer@sonic.net (Ray Fischer) wrote:
>>>>>>>>>NoBody <nobody@nowhere.com> wrote:
>>>>>>>>>> rfischer@sonic.net (Ray Fischer) wrote:
>>>>>>>>>>>NoBody <nobody@nowhere.com> wrote:
>>>>>>>>>>>> rfischer@sonic.net (Ray Fischer) wrote:
>>>>>>>>>>>>>NoBody <nobody@nowhere.com> wrote:
>>>>>>>>>>>>>> rfischer@sonic.net (Ray Fischer) wrote:
>>>>>>>>>>>>>>>NoBody <nobody@nowhere.com> wrote:
>>>
>>>>>>>>>>>>>>>>Yawn...the Dems have controlled all legistlation for nearly three
>>>>>>>>>>>>>>>>years and the Presidency for 1.5 years.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>Which is how the GOP keeps blocking legislation?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>Perhaps if the Dems actually tried working with the opposition instead
>>>>>>>>>>>>>
>>>>>>>>>>>>>The dumbass rightard gets caught lying and tries a different lie.
>>>>>>>>>>>>
>>>>>>>>>>>>Irony anyone?
>>>>>>>>>>>
>>>>>>>>>>>You're a coward as well as a liar.
>>>>>>>>>>>
>>>>>>>>>>>> What lie is that ray-ray?
>>>>>>>>>>>
>>>>>>>>>>>"Dems have controlled all legistlation"
>>>>>>>>>>
>>>>>>>>>>The Dems have had a majority in both houses for a couple of years now
>>>>>>>>>
>>>>>>>>>Don't play stupid, you lying asshole. You should know that it takes
>>>>>>>>>60 votes to override a filibuster in the Senate.
>>>>>>>>
>>>>>>>>Which has nothing to do with what I said.
>>>>>>>
>>>>>>>And there's another lie. The Democrats did NOT control all
>>>>>>>legislation. The Republicans killed more than one bill via
>>>>>>>filibuster.
>>>>>>
>>>>>>Read the full remarks
>>>>>
>>>>>I stop when you start lying.
>>>>
>>>>Since you've not demonstrated one "lie" by me,
>>>
>>>That's another lie.
>>
>>Poor ray-ray seems to think that him repeating a claim is credible
>
>Asshole, the first of your lies is still above, quoted by you
>repeatedly. You claim that "the Dems have controlled all legistlation
>for nearly three years", and yet there have been many laws blocked by
>Republican filibusters.

No lie demonstrated. The Dems held the majority, ran committees and
control what is put together and voted upon.. That is by definition
"controlling all legislation". The fact that Republicans have been
able to stop some of this nonsense via the filibuster doesn't change
what I said.

>
>So obviously you lied and are just lying again and again in order to
>mask your pathetic dishonesty.

Blah blah blah, ray lies again (whodda thunk it?).