In Haskell, we have traverse_
, a function that works on Foldable
types to fold a structure with an applicative function, discarding any result:
traverse_ :: (Applicative f,Foldable t) => (a -> f b) -> t a -> f ()
So we can for instance do this:
traverse_ putStrLn ["Hello, ","world!"]
traverse_ print (Just 3)
What is the Python equivalent to traverse_
? At least for lists?