Last active
November 26, 2020 06:33
-
-
Save sumew/99628dcb35e7ad98ff564e22a4a9d82a to your computer and use it in GitHub Desktop.
A window that can expand to the right and contract from the left
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
case class Window(l: Int, r: Int) { | |
def size = r - l | |
def ||->(i: Int): Window = this.copy(r = r + i) //widen by moving right edge right | |
def |->|(i: Int): Window = this.copy(l = l + i) //shrink by moving left edge right | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment