[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:03849] RE: *arr expansion

From: hal9000@...
Date: 2000-07-05 20:12:38 UTC
List: ruby-talk #3849
Thanks, Guy and Aleksi.

Once again, the problem was between
the chair and the keyboard...  :)

Hal

In article <E536C8EE2A1FD31195370008C79FFA1F13F601@world.cinnober.com>,
  Aleksi Niemel<aleksi.niemela@cinnober.com> wrote:
> >   def initialize(*elts)
> >     @elts = Array.new;
> >     elts.each {|x| @elts << x}
> >     @elts.uniq!
> >   end
>
> Guy already solved the case (I assume), but I've one comment to make.
You
> could probably replace
>
>   elts.each {|x| @elts << x}
>
> with
>
>   @elts.concat elts
>
> or (in this case) just
>
>   @elts = elts.dup
>
> 	- Aleksi
>
>

--
Hal Fulton


Sent via Deja.com http://www.deja.com/
Before you buy.

In This Thread

Prev Next