Even for real numbers, typemin and typemax don't always work – consider
BigInts.


On Tue, Apr 1, 2014 at 12:44 PM, Stefan Karpinski <[email protected]>wrote:

> Extrema make sense for any collection you can sort. E.g.:
>
> julia> words = shuffle!(map(chomp,open(readlines,"/usr/share/dict/words")))
> 235886-element Array{ASCIIString,1}:
>  "Lobelia"
>  "maddeningness"
>  "oases"
>  "kindler"
>  "upgang"
>  "inequable"
>  "stramony"
>  "rhagon"
>  "whizzer"
>  "intercollegian"
>  ⋮
>  "drearily"
>  "dramatizer"
>  "furacity"
>  "opsistype"
>  "carrying"
>  "unfulminated"
>  "inadaptive"
>  "dermographism"
>  "rhabdomancy"
>  "exhaustively"
>
> julia> maximum(words)
> "zythum"
>
>
>
> On Tue, Apr 1, 2014 at 12:41 PM, Andrew Dabrowski 
> <[email protected]>wrote:
>
>> I had assumed that minimum only worked when T <: Real.  A finite
>> collection of elements of an arbitrary type need not have a max or min in
>> any natural sense.
>>
>>
>> On Tuesday, April 1, 2014 12:33:39 PM UTC-4, Stefan Karpinski wrote:
>>>
>>> Type stability is the main concern and consistency is the other. You
>>> want minimum(::Vector{T}) to return an element of type T but not all T have
>>> an infinite value.
>>>
>>>
>

Reply via email to