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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: multimethod.js - a Clojure-inspired multimethod library for JavaScript

49 点作者 KrisJordan超过 13 年前

4 条评论

brian_c超过 13 年前
Neat! I made something (I think) similar a while back, also inspired by Clojure. Mine's more of a proof-of-concept, as I have zero Clojure experience outside some very casual reading.<p><a href="https://github.com/brian-c/patterned-function" rel="nofollow">https://github.com/brian-c/patterned-function</a>
hyperturtle超过 13 年前
I like this very much. It's like a lightweight dispatcher/router/alternative to tons of switches/if &#38; elses. And also that the source is very short and readable.
cfontes超过 13 年前
Nice stuff, I liked the approach.<p>But what is the benchmark for this kind of structure against regular JS workflow? I guess it will be slower, but how much ?
评论 #3361798 未加载
gerggerg超过 13 年前
in coffeescript:<p><pre><code> fib = (n) -&#62; switch n when 0 then 0 when 1 then 1 else fib(n-1) + fib(n-2) alert fib 20</code></pre>
评论 #3362045 未加载