"mark hahn" <mchahn / facelink.com> writes: > I spent some time looking for max(a,b) in ruby before discovering and using > [a,b].max. I was/am very confused about this. Is this a violation of pols > or is it just more object oriented? It is more generic, as. #max is a method of all Enumerable objects (arrays, Files, etc), which works as long as the collection's elements support the comparison operator. So, you could write File.open("/etc/passwd") { |f| puts f.max } File.open("/etc/passwd") { |f| puts f.min } etc. The alternative, having max(a, b, c, ...), would involve reading the entire file's contents into memory, and passing each line as a string to the function. Another option might be having max(anEnumerableObject), but then you'd have the question: where should #max be defined? Putting it in Enumerable itself seems tidy. Regards Dave