Search a sequence for its minimum and stop as soon as the lowest possible value is found

Chris Angelico rosuav at gmail.com
Sat Jan 7 03:19:03 EST 2017


On Sat, Jan 7, 2017 at 7:12 PM, Jussi Piitulainen
<jussi.piitulainen at helsinki.fi> wrote:
> You switched to a simpler operator. Would Haskell notice that
>
>    def minabs(x, y): return min(x, y, key = abs)
>
> has a meaningful zero? Surely it has its limits somewhere and then the
> programmer needs to supply the information.

If the return value of abs is int(0..) then yeah, it could. (Or
whatever the notation is. That's Pike's limited-range-int type
syntax.)

ChrisA



More information about the Python-list mailing list