4 ms·
Pattern matching seems to be very trendy/popular right now. It's a big jump from JS, but https://reasonml.github.io https://reasonml.github.io has very nice pat
by m0meni 8y ago
Pattern matching seems to be very trendy/popular right now. It's a big jump from JS, but https://reasonml.github.io https://reasonml.github.io has very nice pattern matching that you can use, and it integrates with the JS ecosystem very nicely.
- adamnemecek 8y agoIt's been "trendy" since the 70's. It's more that more people have experience with it and realize that pattern matching is like conditional statements on steroids.
- m0meni 8y agoFair point. What I was trying to express was that it seems like the JS ecosystem has really been pushing and encouraging functional programming in a big way, which speaks to your idea that more people have experience with it.
- lmm 8y ago> It's been "trendy" since the 70's. It's been possible since the '70s but I've seen a lot more talking about it in the last 5-10 years.
- stiGGG 8y agoYeah, this applies to all that old Lisp features.
- _delirium 8y agoI think of full-featured pattern matching as a fairly recent addition even to Lisp. Lisp has had some pattern-matching constructs forever of course (cond, destructuring-bind, Norvig's sexp matcher from PAIP [1], etc.). But it's only with the more recent emergence of optima [2] as a de-facto standard that it now has really good pattern matching. It was probably the #1 thing I missed in Lisp, after having used ML a bit, until optima came along. [1] https://github.com/norvig/paip-lisp/blob/master/lisp/patmatch.lisp https://github.com/norvig/paip-lisp/blob/master/lisp/patmatc... [2] https://github.com/m2ym/optima https://github.com/m2ym/optima
- lispm 8y agoThe first embedded language for programming with patterns for Lisp was implemented 1962 by Daniel Bobrow. https://dspace.mit.edu/handle/1721.1/6106 https://dspace.mit.edu/handle/1721.1/6106
- masklinn 8y agoAFAIK pattern-matching is not a historical Lisp feature, it's usually been limited to simple destructuring. In the modern acception of tree patterns (as opposed to text patterns aka regular expressions), I guess it comes from ML (and possibly prolog but prolog's unification goes even further?): it doesn't look like ISWIM had tree patterns and I can't find older references.
- lispm 8y agoIn Lisp pattern-based programming has been first implemented in 1962 in by D.Bobrow (METEOR). From then on there are many implementations of pattern matching in Lisp based software, from Planner, to rule-based systems, LISP70 (Tesler, ...)...
- Roboprog 8y agoThis makes me sad. As somebody who started a CS degree back in the early 80s (finishing in the late 80s), and who had a few glimpses of languages which didn’t suck, the switch down to “everything is an 8086 running C code, if not x86 assembler” was an incredibly destructive event in this industry. I was going to specialize in AI in my major, but I guess it was about 25 years too early. But that’s another tangent.
- kbp 8y ago> AFAIK pattern-matching is not a historical Lisp feature Aside from full packages like what lispm mentioned, implementing pattern matching (and later, full Prolog-style unification) in Lisp is a very common exercise in beginner Lisp textbooks, going back decades.
- lmm 8y agoI'd say it's less about Lisp and more that the ML lineage is finally getting its day in the sun (and not before time).
- faitswulff 8y agoIIRC, a big blocker to adopting ReasonML for a lot of people is its current lack of async / await support: https://github.com/facebook/reason/issues/1321 https://github.com/facebook/reason/issues/1321