Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add useful "predefined" streams #24

Closed
briancavalier opened this issue Aug 22, 2014 · 3 comments
Closed

Add useful "predefined" streams #24

briancavalier opened this issue Aug 22, 2014 · 3 comments

Comments

@briancavalier
Copy link
Member

The ones that come to mind immediately are numeric ranges, ie all integers from 0 to 99, or all decimal numbers from 0 to 9, stepping by 0.25. They're easy to create using most.iterate, but maybe slightly verbose without arrow functions:

// ES5
most.iterate(function(x) { return x + 1; }, 0).take(100); // integers 0 - 99
most.iterate(function(x) { return x + .25; }, 0).take(10 / .25); // 0, .25, .5, .75, 1.0, 1.25 ...

// ES6
most.iterate(x => x + 1, 0).take(100); // arrows ftw
most.iterate(x => x + .25, 0).take(10 / .25); // yay arrows, division is still annoying

In writing that out, I also noticed how annoying it is to have to divide to do the take correctly :(. So, for example, maybe we could provide something like most.range that hides the details:

most.range(0, 100); // integers 0-99
most.range(0, 10, .25); // 0, .25, .5, .75, 1.0, 1.25 ...

There may be other useful streams, but numbers are the ones the came to mind first, and numeric ranges are generally useful in lots of situations.

Are there other predefined streams that seem like they'd be broadly useful? Should we just provide numeric ranges? Would it be better to stick with base building blocks for now? Is this the slippery slope that leads to a huge, unwieldy API?

@unscriptable
Copy link
Member

Is this the slippery slope that leads to a huge, unwieldy API?

🎱 Signs point to "yes".

It'd be nice to see what the community ends up doing with most.js, then think about what to pre-create. Hmmm.... then again, the community might need help knowing what they can do with most.js. My instinct says that examples might be a better place to show users what they can do. Does it make sense to create some helpers inside the examples?

If we decide to add helpers like these to most.js, perhaps put them in ancillary files? e.g. most/range or most/numeric?

@briancavalier
Copy link
Member Author

Does it make sense to create some helpers inside the examples?

Seems like a great idea. If several people say something like "jeez, I do that all the time, why isn't that built in???", we could consider pulling it in.

If we decide to add helpers like these to most.js, perhaps put them in ancillary files? e.g. most/range or most/numeric?

Yeah, I like that too. We can probably make the call as needed, since some things might end up being so universally useful that we'd want them in main, while others we might not.

@briancavalier
Copy link
Member Author

It'd be nice to see what the community ends up doing with most.js

I think this is the way to go. Similarly, we can keep an eye out for things that seem to be "missing", ie if we consistently hear "I sure wish it was easier to do X", then we can create an issue to discuss providing convenience method X.

So, I we should open more focused issues as they arise. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants