Skip to content

Instantly share code, notes, and snippets.

@TheSeamau5
Created April 10, 2015 23:58
Show Gist options
  • Save TheSeamau5/085c89ca456be16a9ab2 to your computer and use it in GitHub Desktop.
Save TheSeamau5/085c89ca456be16a9ab2 to your computer and use it in GitHub Desktop.
Shrink Strategy for Ints
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