TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Making the obvious code fast

23 点作者 dalailambda将近 9 年前

2 条评论

Nelkins将近 9 年前
Great work on the SIMDArray extensions, always nice to get speed while maintaining a functional style.<p>BTW, I don&#x27;t think you need a third party library like Nessos to get that streaming behavior (iterating over the items in a single pass). Seq will do the job just fine. For example this code:<p><pre><code> let arr = [|1;2;3|] let sumSquares = arr |&gt; Seq.map (fun x -&gt; printfn &quot;%i map&quot; x; x*x) |&gt; Seq.fold(fun sum x -&gt; printfn &quot;%i fold&quot; x; sum + x) </code></pre> will produce this output in F# Interactive:<p><pre><code> &gt; 1 map 1 fold 2 map 4 fold 3 map 9 fold val arr : int [] = [|1; 2; 3|] val sumSquares : int = 14</code></pre>
camkego将近 9 年前
Nice article!