Giter Site home page Giter Site logo

Comments (2)

pineapplemachine avatar pineapplemachine commented on August 25, 2024 1

Consumer specification, after lots of rumination. These are attributes of the object to be passed to the defineConsumer function.

summary - same as sequence types
docs - same as sequence types
tests - same as sequence types
converter - same as sequence converter attribute, but applies to consumers instead
constructor - same as sequence types
pushFront - push an element from the front of a sequence
pushBack - push an element from the back of a sequence (optional!)
pushEnd - inform the consumer that there are no more elements to push
done - return true when the consumer either matched or didn't match the subject
match - return true when the consumer matches the subject
copy - return a copy of this consumer

The distinction between done and match is slightly weird:

done is true when the consumer won't accept more elements. It means either, "I've matched a complete pattern and if you push any more I will stop matching it", or "I've failed to match the pattern and nothing you push now will change it"

match is true when the consumer matches the subject. It does not necessarily imply that, after pushing another element, the consumer will no longer match it. To get the full (longest) match of a consumer, one should keep pushing until done is true and use the most recent element where match was once true to be the end of the match. (If match was never true, then there is no match at all.)

from higher.

pineapplemachine avatar pineapplemachine commented on August 25, 2024

Consumers should also support reversing where possible

from higher.

Related Issues (20)

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.