- Is there a plan for a shorter alternative to ‘Iterators.filter’ and the like? The ‘Iterators’ word takes quite a number of columns, especially if used multiple times.
- Why is it not allowed to use ‘takewhile’, ‘dropwhile’, and ‘countfrom’ without ‘Iterators’, like ‘enumerate’? Possible conflict?
- Would it be possible to add something like ‘1:_’ as an alternative to ‘countfrom’?
- No plan for ‘Iterators.map’?
- Not really. Base already has a
filterfunction, which is eager instead of lazy. One could of course add an alias, but just saving a handful of characters might not be worth adding another export to Base for. You could always do, e.g.
const ifilter = Iterators.filteron top of your own code to have a shorter alias.
- Similar argument to above, but those names could potentially be exported. I am just not 100% sure, they’re used that often in code to justify exporting them. Another advantage of having to be explicit about them being in the
Iteratorssubmodule is that it’s clear straightaway that they behave lazily to anyone looking at your code.
- Most likely not. The
_syntax has been proposed as syntax for creating anonymous functions, which I am pretty sure will be added to Julia eventually once all the details have been worked out. InfiniteArrays.jl exports
∞, which is similar to what you are asking for.
- You are basically asking for generators (i.e.
(f(i) for i in itr)), which you can also create directly with
Iterators.maphas actually been proposed as an alias here, so that might also make it into Base.
Note also that if you use
dropwhile or other iterators a lot so that the
Iterators. prefix becomes bothering, just do
using Iterators: dropwhile, or simply
using Iterators (which exports most of the iterators from that module).