TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

49 pointsby KrisJordanover 13 years ago

4 comments

brian_cover 13 years ago
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>
hyperturtleover 13 years ago
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.
cfontesover 13 years ago
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 未加载
gerggergover 13 years ago
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 未加载