OC

OCaml-like pattern-matching with vanilla JavaScript (no transpiler)

Hacker News

OCaml-like pattern-matching with vanilla JavaScript (no transpiler)

A few years back I wrote a little library that implements OCaml-inspired pattern matching using just plan JavaScript destructuring syntax. I don't think I ever shared it here. Thought you might find it interesting. I did this just for fun, don't use it in prod. It's very inefficient. Have a look at the source for a chuckle, it's a single 145 line file. Link: https://github.com/mrkev/fnMatch Playground: https://aykev.dev/fnMatch/

Share card

Actual performance

3points
1comments
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: single, using · Missing: mac, agents, macos
71%71% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Indie HackersFits the IH revenue-focused audience · Missing: supports, reddit linkedin, podcasting
70%70% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Missing: https docs, excited, just released
59%59% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
AppSumoStrong fit for a featured deal · Strong signals: efficient · Missing: plus, platform, intuitive
51%51% predicted probability of success on AppSumo, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Missing: mobile apps, ios, personal
49%49% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Missing: arr, mrr, revenue
11%11% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Incorrect prediction on native model

Similar products

Pa
Pattern matching in JavaScript without a transpiler49%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Pattern matching in JavaScript without a transpiler

Hacker News2
Mo
Motif – Scala-like pattern matching with Java 840%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Motif – Scala-like pattern matching with Java 8

Hacker News51
Ef
Efficient pattern matching for JavaScript56%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Efficient pattern matching for JavaScript

Hacker News5
My
My first attempt at adding pattern matching to C#52%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

My first attempt at adding pattern matching to C#

Hacker News1
Vi
VisualTail graphical tail with pattern matching44%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

VisualTail graphical tail with pattern matching

Hacker News1
Ma
Matches.js -- Powerful Pattern Matching for Javascript56%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Matches.js -- Powerful Pattern Matching for Javascript

Hacker News96
Ma
MarkovJunior, PPL based on pattern matching and constraint propagation47%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

MarkovJunior, PPL based on pattern matching and constraint propagation

Hacker News36
A
A gem for method overloading based on pattern matching for Ruby31%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A gem for method overloading based on pattern matching for Ruby

Hacker News3
De
Derive4j – Java8 support for ADTs, pattern matching, and more42%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Derive4j – Java8 support for ADTs, pattern matching, and more

Hacker News2
De
Derive4j – Java8 support for ADTs, pattern matching, and more42%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Derive4j – Java8 support for ADTs, pattern matching, and more

Hacker News10