Looks awesome. It is kind of regex on a higher level. It would be cool if the pattern matching went all the way down to real regexes.
> people don't know how awesome pattern-matching is I didn't before but I can definitely see how it will be useful. I've done this the hard way many times. One thing that pops to mind immediately is returns from APIs like from Amazon. > Creating your own pattern matching language seems over kill. I don't understand. How can you match a pattern that isn't specified? I tried to understand your code without luck, at least in my five minutes of trying. On Sat, Jul 21, 2012 at 2:42 AM, Nuno Job <[email protected]> wrote: > Creating your own pattern matching language seems over kill. Also why not > just do it in plain old javascript? > > https://github.com/dscape/p/tree/master/samples > > Not perfect, but it works. > > Nuno > > > On Sat, Jul 21, 2012 at 7:00 AM, Joshua Gross <[email protected]>wrote: > >> Peter, this is real cool! Sadly I don't expect it to gain much traffic >> short-term because people don't know how awesome pattern-matching is. I'm >> pumped to have this available in JS though; will check it out seriously. >> >> Joshua Gross >> Christian / SpanDeX, Inc. / BA of Computer Science, UW-Madison 2013 >> 414-377-1041 / http://www.joshisgross.com / http://www.spandex.io >> >> >> >> On 15 July 2012 08:21, pb82 <[email protected]> wrote: >> >>> Hello, >>> >>> i've created a module named 'missmatch'. It allows to match arbitrarily >>> nested JavaScript values against patterns and bind values in those patterns >>> to variables (which can be used in a handler function). It's inspired by >>> the built-in pattern matching of languages like Haskell or OCaml. It's >>> written purely in JavaScript and can be used with node.js or in a browser. >>> The pattern compiler does not use eval (or the Function constructor). >>> >>> It exports three functions, match, matchJSON and compile (which lets you >>> compile a pattern to a matching-function). There is a README and some usage >>> examples on the repo: >>> >>> https://github.com/pb82/MissMatch >>> >>> It can be installed with: >>> >>> npm install missmatch >>> (optional) npm test missmatch >>> >>> Hope someone finds this useful :) >>> >>> Regards, >>> Peter >>> >>> -- >>> Job Board: http://jobs.nodejs.org/ >>> Posting guidelines: >>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >>> You received this message because you are subscribed to the Google >>> Groups "nodejs" group. >>> To post to this group, send email to [email protected] >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://groups.google.com/group/nodejs?hl=en?hl=en >>> >> >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
