次世代言語議論スレ[Go Rust Kotlin Scala]第4世代at TECH
次世代言語議論スレ[Go Rust Kotlin Scala]第4世代 - 暇つぶし2ch372:デフォルトの名無しさん
17/05/12 06:43:44.99 4vGyFDSj.net
実装基準がよくわからない。
import System.Environment(getArgs)
import Data.List(isInfixOf,isPrefixOf,tails,findIndices)
search1 = isInfixOf
search2 word = length . filter (isPrefixOf word) . tails
search3 word content = (ps /= [], length ps, ps)
 where ps = concat . zipWith indices [0..] $ lines content
    indices l = zip (repeat l) . findIndices (isPrefixOf word) . tails
main = do
 (file:word:_) <- getArgs
 print =<< search1 word <$> readFile file
 print =<< search2 word <$> readFile file
 print =<< search3 word <$> readFile file


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch