------_extPart_001_01C5B801.85C39956
Content-Type: text/plain;
	charsets-ascii"
Content-Transfer-Encoding: quoted-printable

 <<quiz_46_ndiff.rb>> This quiz made me delve into the darkened
alleyways of undocumented standard libraries (well, bigdecimal). Luckily
the whole thing worked exactly as guessed - probably why nobody has
bothered documenting it yet.

Is there a library that adds the median/average/etc. methods to array? I
rolled that myself because I didn't see it in the std lib.


Also, the statistics bit in the quiz description had "Average" and
"Mean" - I take it that was meant to be Mean and Median? That's what I
implemented.

#####################################################################################
This email has been scanned by MailMarshal, an email content filter.
#####################################################################################

------_extPart_001_01C5B801.85C39956
Content-Type: application/octet-stream;
	nameuiz_46_ndiff.rb"
Content-Transfer-Encoding: base64
Content-Description: quiz_46_ndiff.rb
Content-Disposition: attachment;
	filenameuiz_46_ndiff.rb"

cmVxdWlyZSAnZ2VuZXJhdG9yJw0KcmVxdWlyZSAncGF0aG5hbWUnDQpyZXF1aXJlICdvcHRwYXJz
ZScNCnJlcXVpcmUgJ2JpZ2RlY2ltYWwnDQoNCmNsYXNzIE51bWJlckxpbmUNCglpbmNsdWRlIEVu
dW1lcmFibGUNCglkZWYgaW5pdGlhbGl6ZShsaW5lKQ0KCQlAbGluZSA9IGxpbmUNCgllbmQNCglk
ZWYgZWFjaA0KCQlAbGluZS5zY2FuKC8oKC0pPyhbMC05XSt8XC4pXC4/KFswLTldKyk/W0VlXT8o
Wy0rXT9bMC05XSspPykvKSBkbyB8bWF0Y2h8DQoJCQl5aWVsZCBCaWdEZWNpbWFsLm5ldyhtYXRj
aFswXSkNCgkJZW5kCQ0KCWVuZA0KCWRlZiB0b19zDQoJCUBsaW5lDQoJZW5kDQplbmQNCg0KY2xh
c3MgTnVtZXJpY2FsRGlmZmVyZW5jZXINCglhdHRyX2FjY2Vzc29yIDpkaWdpdHMsIDp0b2xlcmFu
Y2UNCglkZWYgaW5pdGlhbGl6ZQ0KCQlAZGlnaXRzID0gMA0KCQlAdG9sZXJhbmNlID0gMC4wDQoJ
ZW5kDQoJZ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