In #Haskell,
(foldl1' nums) <$> [min, max]
gives [a, b] being the minimum and maximum of nums. Is there a concise way to get a tuple instead without writing fold twice? Seems like something to do with bifunctors or arrows, but I haven't managed to wrap my head around it yet. (I realize this is somewhat pointless golfing)
Add comment