Jiv*_*van 4 haskell list filter maybe map-function
使用列表Maybe a,如何过滤并仅获取列表中不是的元素Nothing?
-- input
pas = [Just 3, Just 1, Just 5, Just 9, Nothing, Just 10, Nothing] :: [Maybe Int]
-- expected output
new_pas = [3, 1, 5, 9, 10]
Run Code Online (Sandbox Code Playgroud)
我尝试了不同的使用方式map和查看方式,mapMaybe但找不到正确的组合。