Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 F# 中有一个 N 元素长列表,我想提取所有可能的 M 元素长重叠连续子列表(M < N),例如:
[1; 2; 3; 4; 5]
生产
[[1; 2; 3]; [2; 3; 4]; [3; 4; 5]]
对于 M = 3。
我知道这样做的必要方式,但是有一个简洁的功能技巧吗?
为此有一个内置函数:Seq.windowed
Seq.windowed