Comments (5)
An adaptor for product is a good idea, I guess it's the most natural way to use it. Not sure if we can make it expand tuples like the iproduct macro does (((x, y), z) → (x, y, z)
).
from itertools.
That would be preferable, but I think it requires variadic generics, or at minimum having two impls, one for Item=A
and one for Item=(A,B)
.
I'd be satisfied with the basics for now. I can always map(|((x,y),z)| (x,y,z))
until then.
from itertools.
Is there any reason to prefer the long name cartesian_product
? I.e. are there other products we might want to add?
from itertools.
@bluss Can't think of any others (not that there aren't any), but we want to avoid product()
because it's taken by MultiplicativeIterator. times()
would work too, though it's less specific.
from itertools.
Something else very useful is a Cartesian product without a hardcoded length, i.e., concretely something like taking a vector of iterators and returning a iterator of vectors: a form of Haskell's sequenceA
, where
sequenceA [[0..2], [0..2], [0..2]] == [[0,0,0],[0,0,1],[0,0,2],[0,1,0],[0,1,1],[0,1,2],[0,2,0],[0,2,1],[0,2,2],[1,0,0],[1,0,1],[1,0,2],[1,1,0],[1,1,1],[1,1,2],[1,2,0],[1,2,1],[1,2,2],[2,0,0],[2,0,1],[2,0,2],[2,1,0],[2,1,1],[2,1,2],[2,2,0],[2,2,1],[2,2,2]]
from itertools.
Related Issues (20)
- Feature Request: `raise_results()` adapter HOT 1
- The cutting block: These features will be removed from itertools eventually (2)
- `k_smallest[_by]/tail`: similarities and differences
- Implement `DoubleEndedIterator` for `Powerset` HOT 3
- Support for TryFrom::try_from on the items of iterator HOT 5
- Iterators generating (many) vectors (v2)
- using izip is slower than ziping 3 times HOT 7
- FormatWith should implement fmt::Debug HOT 1
- `Itertools::dedup_by[_key]` vs `Vec`
- Merge `MultiPeek` and `PeekNth` HOT 1
- Feature request: `try_collect_vec()` HOT 3
- feature request: split_vec() HOT 1
- Itertools 0.13.0 breaks strum derive macros if both are in scope at the same time. HOT 8
- get (new range iterator) breaks strum HOT 2
- How does tree_reduce achieve O(ln(n)) operations? HOT 9
- Implement `DoubleEndedIterator` for `FilterOk` HOT 3
- Do we need a `rfind_map`? HOT 5
- `.try_collect()` for `Iterator<Option>` HOT 7
- `maybe_` for `cmp`, `partial_cmp`, `eq`, `ne`, `lt`, `le`, `gt`, `ge` HOT 2
- Add single-element tuple for `collect_tuple` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from itertools.