[#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:03817] Re: Array.pick

From: Clemens Hintze <c.hintze@...>
Date: 2000-07-05 05:40:06 UTC
List: ruby-talk #3817
Conrad Schneiker wrote:
>
> Hi,

Hi Conrad,

> "Aleksi Niemel" wrote
> 
> > I've found following snippet quite handy. Dunno if there's wider
> > need for this.
> >
> > class Array
> > def pick( count = -1 )
> > if count >= 0
> > ary = []
> > count.times do
> > ary << self.delete_at( rand( self.length ) )
> > end
> > return ary
> > end
> > self.delete_at( rand( self.length ) )
> > end
> > end
> 
> <snip>
> 
> Just a general comment--a brief statement of purpose and using
> conventional indentation would be helpful. Apart from what should be
  ^^^^^^^^^^^^^^^^^^^^^^^^

I fully agree with you ...

This is the only one remaining advantage of Python over Ruby, IMHO!
Use indentation for grouping ... :-)

Code like this one above would simply not possible using Python ;-)

BTW: I do not propose that Ruby should use indentation ...
Disclaimer: I am fully aware of the possible disadvantages if grouping 
  is via indentation instead of language elements be them '{...}' or
  other!

...

> Conrad

\cle

--
Clemens Hintze  mailto: c.hintze@gmx.net

In This Thread

Prev Next