Created
November 15, 2019 18:18
-
-
Save dmwit/6dce178eab1988fc7219153534ad8788 to your computer and use it in GitHub Desktop.
from Dmwit.hs
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
foldb1 op = foldb' where | |
pairwise (x:y:rest) = op x y : pairwise rest | |
pairwise shortList = shortList | |
foldb' xs@(_:_:_) = foldb' (pairwise xs) | |
foldb' [x] = x | |
foldb op def xs = foldb1 op (def:xs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment