Created
February 9, 2018 04:26
-
-
Save jkoppel/867b006af652f655dc19ab5ddc266aba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def normalize_interval(a, b): | |
if a <= b: return (a, b) | |
else: return (a, a) | |
# good version | |
def intersect(oth): | |
return interval(normalize_interval(min(self.hi, oth,hi), max(self.low, oth.low))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment