Adding here a few ideas for new features
See original GitHub issueCombinatory generators length
It would be nice to have handy functions to calculate the length of a combinatory generator (given the length of the input sequence). This way I can pick the nth item (for example).
flatten
A simple flatten (only one level), can be useful. For example I could use flatten(zipAll(...))
to interleave many iterators. You can do the same with “chain” and the spread operator, but would require to expand the argument in an array and it would be inefficient
window
window(3, range(100))
[0, 1, 2] [1, 2, 3] [2, 3, 4] [3, 4, 5] etc.
Better to pick up a different name though
collate
It takes as arguments n sorted iterable. It returns a single sorted iterable.
Reduce variant
Similar to the reduce but returning a iterable that return the accumulator. I don’t know yet how to call it.
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (4 by maintainers)
Top Results From Across the Web
How to Get Ideas for Features? - Infinity
Here's how to add new ideas to your Infinity roadmap: Step 1: Open the Roadmap folder from the Product Roadmap template. Step 2:...
Read more >Getting Ideas For New Product Features | by Arpit Rai - Medium
You should maintain a list of all these ideas in a Google Sheet (or Excel), or even a project management tool like Asana...
Read more >Adding new features to your product is not going to make it ...
I will break it down into a couple of basic ideas on why adding new features is not always a good idea. How...
Read more >Feature Requests: How to Collect Them and Engage Users in ...
Here are some of the top ways to spread awareness about your designated channel for feature requests: In-app widget that says “Submit an...
Read more >How to Announce New Features to Drive Product Adoption
You can announce new features with in-product announcements (use prompts like modals, lightboxes, or hotspots to drive ... Here are some examples for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There’s nothing conceptually wrong with not treating strings as iterables for the purpose of a flatten, even though they technically are. I’d argue that even a not arbitrarily deep flatten implementation would want to do that. Obviously if you did let flatten into a string it would blow up as the string iterator returns other strings, which becomes an infinite recursion.
As for “all other types” being iterable, I’m sure I don’t know what you mean. Almost every type in javascript is derived from Object, which is not iterable, and this is probably a big part of why. That leaves Array, Map, Set, and classes with iterators defined, which are all acceptable things to flatten.
Added #79 #80