[#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:03796] Re: Array.uniq! returning nil

From: Hugh Sasse Staff Elec Eng <hgs@...>
Date: 2000-07-04 13:39:06 UTC
List: ruby-talk #3796
On Tue, 4 Jul 2000, [iso-8859-1] Aleksi Niemelwrote:

> And, now the new trick, add Array.uniq!? which would work like current
> Array.uniq!. The actual semantic hint the developer should get when he sees
> obj.method!? is 'this method modifies the object and returns something
> (possibly boolean) describing if any action was taken'. 

Is this a more idiomatic solution?

irb(main):014:0> example = "hello\n"
"hello\n"
irb(main):015:0> example.display()
hello
nil
irb(main):016:0> (example.chomp! || example).display
hellonil
irb(main):017:0> (example.chomp! || example).display
hellonil
irb(main):018:0> 

	Hugh
	hgs@dmu.ac.uk


In This Thread