On 2001-08-05 05:52:04Z, Dave Thomas <Dave / PragmaticProgrammer.com> wrote:
> For example, your shuffle example doesn't really need an Array
> parameter. All it requires is an object that responds to #length, and
> returns a value when sent #[]. If we remove the test from from your

Ah, thanks!

And I don't have to check the existence of #length and #[]
because the interpreter will do it for me.

Or is it common pratice to check these with defined?(data.[]) and
defined?(data.length)? This way it's easier to find a bug when
calling Shuffle#new with the wrong object.