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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

bilby.js - Serious functional programming library for JavaScript

3 点作者 jhck超过 12 年前

1 comment

pufuwozu超过 12 年前
Thanks for the submission! The GitHub repository might be more interesting:<p><a href="https://github.com/pufuwozu/bilby.js" rel="nofollow">https://github.com/pufuwozu/bilby.js</a><p>The syntax examples show off a bit of everything:<p>Monads:<p><pre><code> λ.Do()( λ.some(1) &#62;= function(x) { return x &#60; 0 ? λ.none : λ.some(x + 2); } ).getOrElse(0) == 3; </code></pre> Kleislis:<p><pre><code> λ.Do()( function(x) { return x &#60; 0 ? λ.none : λ.some(x + 1); } &#62;&#62; function(x) { return x % 2 != 0 ? λ.none : λ.some(x + 1); } )(1).getOrElse(0) == 3; </code></pre> Functors:<p><pre><code> λ.Do()( λ.some(1) &#60; add(2) ).getOrElse(0) == 3; </code></pre> Applicatives:<p><pre><code> λ.Do()( λ.some(add) * λ.some(1) * λ.some(2) ).getOrElse(0) == 3; </code></pre> Semigroups:<p><pre><code> λ.Do()( λ.some(1) + λ.some(2) ).getOrElse(0) == 3;</code></pre>