Created
April 10, 2015 23:58
-
-
Save TheSeamau5/085c89ca456be16a9ab2 to your computer and use it in GitHub Desktop.
Shrink Strategy for Ints
This file contains hidden or 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
shrinkInt : Int -> List Int | |
shrinkInt n = | |
if n < 0 | |
then | |
-n :: List.map ((*) -1) (series 0 -n) | |
else | |
series 0 n | |
series : Int -> Int -> List Int | |
series low high = | |
if | low >= high -> [] | |
| low == high - 1 -> [low] | |
| otherwise -> | |
let low' = low + ((high - low) // 2) | |
in | |
low :: series low' high |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment