[#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:03816] Re: Kernel.rand

From: Mathieu Bouchard <matju@...>
Date: 2000-07-05 05:39:31 UTC
List: ruby-talk #3816
> No, the old behavior was inconsistent.  The options are
>   * Python's way (modulo)
>   * Current behavior
>   * Current behavior + modulo
> What else?



module Useful
	def Useful.div(a,b)
		(a.to_f / b).floor
	end
	def Useful.divmod(a,b)
		d = Useful.div(a,b)
		[d, a-b*d]
	end
	def Useful.mod(a,b)
		Useful.divmod(a,b)[1]
	end
end



Mathieu Bouchard


In This Thread

Prev Next