惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Schneier on Security
Schneier on Security
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
A
About on SuperTechFans
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
V2EX - 技术
V2EX - 技术
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
V
Visual Studio Blog
Martin Fowler
Martin Fowler
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
F
Full Disclosure
Scott Helme
Scott Helme
H
Heimdal Security Blog
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V
Vulnerabilities – Threatpost
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
Jina AI
Jina AI
S
Securelist
小众软件
小众软件
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
博客园 - 三生石上(FineUI控件)
量子位

Haskell

哪个函数返回参数本身? - V2EX GHC 9.2 发布了 - V2EX 那本书可以称为编程界的《葵花宝典》? - V2EX 国内有什么好的 Haskell 社群( qq/wechat/论坛)吗? - V2EX 如何修复错误“Variable not in scope: md5 :: C8.ByteString -> a0”? - V2EX Haskell 这门语言怎么样? - V2EX 写了篇 Applicative 的小总结~ - V2EX 有没有小伙伴一起来团购 Haskell Programming 这本书 - V2EX 为什么学了 Haskell,果然印证了 V2EX 上的 智者(忘记网名)的断论,“学了 Haskell,回不去了“, 回不去了耶。 - V2EX 一个很酷的 Hakyll 静态博客例子 - V2EX 学习 Haskell 过程中,写了一篇对 Functor 的总结 - V2EX 发现一本好书《Haskell Data Analysis Cookbook》 - V2EX How to Write a Spelling Corrector - Haskell - V2EX Haskell 入门学习资料整理 - V2EX Haskell for Mac - V2EX Yesod - Haskell 的 Web 开发框架 - V2EX Haskell 怎么在只有一个元素的列表上定义函数 - V2EX 一段 Haskell 代码求助! - V2EX Haskell 很适合做编译器前端 - V2EX Introduction to Haskell - V2EX 在 Github 上弄了一个 blog, 写写 Haskell - V2EX 关于一些名词翻译的确定 - V2EX 有没有人有兴趣补完 《趣学指南》 的汉语翻译? - V2EX 贺 haskell 开区,这是交流处。 - V2EX
贴 Haskell 代码,解一道小题。给任意字符串,找出长度最长的数字串。请随意扔砖头。 http://www.v2ex.com/t/259360#reply18 - V2EX
myid · 2016-02-28 · via Haskell

import Data.Char (isDigit)

longestInts :: String -> [Int]
longestInts xs = map (digitsToInt) $ longestLength $ extractDigits xs

extractDigits :: String -> [String]
extractDigits [] = []
extractDigits xs
| null $ dropWhile (not.isDigit) xs = []
| otherwise = (takeWhile (isDigit) $ dropWhile (not.isDigit) xs) : (extractDigits $ dropWhile (isDigit) $ dropWhile (not.isDigit) xs)

longestLength :: [[a]] -> [[a]]
longestLength xs = filter (\x -> length x == (maximum $ map (length) xs)) xs