Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/libraries/fps/tests/lazylines.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as C
import System.IO
import Maybe

main = print . length . mapMaybe (sel . C.words) =<< B.hGetLines stdin
    where
        sel []     = Nothing
        sel (x:xs) = if x == (C.pack "The") then Just xs else Nothing

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.