question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding here a few ideas for new features

See original GitHub issue

Combinatory 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:closed
  • Created 5 years ago
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
conartist6commented, Dec 6, 2018

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.

1reaction
sithmelcommented, Dec 5, 2018

Added #79 #80

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found