Giter Site home page Giter Site logo

joeldentici / monadic-js Goto Github PK

View Code? Open in Web Editor NEW
10.0 0.0 0.0 185 KB

Algebraic structure implementations, do-notation, and operators to truly live the fantasy

License: MIT License

JavaScript 100.00%
monad functor dsl parse free-monads fantasy-land do-notation algebraic-structures state-monad task

monadic-js's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

monadic-js's Issues

Left recursion results -- better approach

Right now left recursion curtailment is using parity of the parser to determine whether we should curtail at 1 + remaining length or remaining length. This is necessary for the result to be properly passed back up the recursive call stack when we finally find a parser that doesn't lead to curtailment.

An improvement on what is currently being done is to ignore parity all together and just accept the longest result (by comparing it to the stored result and storing whichever is longer). We can determine the longest result simply by whichever has the furthest position, which removes having to do any error-prone checks on the actual result (which literally should never be done on polymorphic code). This will work regardless of the parity of the parser.

Doing this will make it actually feasible to memoize a lot more of the parsers in the do-notation parse module (since right now it would require calculating the parity of all the parsers). This could lead to much faster parsing of do-notation. In fact, doing this will make it possible to just bring back default memoization if that is desired.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.