The objective was to investigate if it was possible to implement pattern matching in js without changing the language (eg compiling strings)
Nuno Sent from my iPhone On Jul 22, 2012, at 1:42 AM, Nuno Job <[email protected]> wrote: > Check the samples. Maybe hof.js. > > Read me is crap, but pull requests are welcomed! > > If you want a real functional language that compiles to js check roy or fay. > > Sent from my iPhone > > On Jul 22, 2012, at 1:33 AM, Joshua Gross <[email protected]> wrote: > >> I have no idea what dscape/p/ is trying to achieve. Missmatch looks and >> feels more like Haskell or OCaml to me, though your comment on strings is >> fair. (if you can explain those 30 LOCs and why I'd enjoy using them, go for >> it :)) >> >> Also, UNDER 1k including HEAVY commenting, to be fair. >> >> -- Joshua Gross >> Christian / Web Development Consultant / BA Candidate of Computer Science, >> UW-Madison 2013 >> 414-377-1041 / http://www.joshisgross.com >> >> On Jul 21, 2012, at 7:02 PM, Nuno Job <[email protected]> wrote: >> >>> 1 thousands lines of code? wow. >>> >>> I appreciate the work and thought put into this, but pattern does the same >>> thing (and in my opinion in a more elegant way) in 30 loc. (i.e. >>> https://github.com/dscape/p/blob/master/pattern.js) >>> >>> i also have a hard time with people saying a string for pattern matching is >>> elegant. wondering if anyone here ever used haskell :) >>> >>> nuno >>> >>> >>> On Sat, Jul 21, 2012 at 9:24 PM, Joshua Gross <[email protected]> >>> wrote: >>> I disagree that it's overkill. It's less than 1k lines (of heavily >>> commented code), well tested, and you can "compile" it to save computation >>> time. It works really well, too. +1 >>> >>> -- Joshua Gross >>> Christian / Web Development Consultant / BA Candidate of Computer Science, >>> UW-Madison 2013 >>> 414-377-1041 / http://www.joshisgross.com >>> >>> On Jul 21, 2012, at 2:10 PM, Mark Hahn <[email protected]> wrote: >>> >>>> 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 >>> >>> -- >>> 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
