You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
saddle-points/test: Do not use head on empty list (#1138)
The case with input `[]` does not work well with the
`columns = length $ head xss`.
It's somewhat hard to have an implementation that actually causes
`head []` to be evalauted, but an example implementation that in fact
does is:
```haskell
saddlePoints arr = if snd (snd (bounds arr)) == 3 then [(2, 1)] else []
```
Since there is a possible implementation that could cause `head []` to
be evaluated, we should rewrite it so that we never use `head` on an
empty list.
0 commit comments