Integrated Dynamics

Integrated Dynamics

63M Downloads

Add a zip operator

hnOsmium0001 opened this issue · 3 comments

commented

Issue type:

  • ➕ Feature request

Short description:

Add a zip function that works like the one from Python, which takes several lists and combines them to a list of lists containing elements from the same index.
For example zip([1,2,3,4],[20,19,18,17]) returns [[1,20],[2,19],[3,18],[4,17]]

commented

I don't like the implied type signature of this operator. I'd rather see one of two alternatives:

  1. transpose([[1,2,3,4],[20,19,18,17]]) returns [[1,20],[2,19],[3,18],[4,17]]
  2. zip([1,2,3,4],[20,19,18,17]) returns [(1,20),(2,19),(3,18),(4,17)] (requires that we add tuple types)
commented

... requires that we add tuple types

I don't personally think that it is worth adding tuple types just for the sake of the type signature. If we have more than just this reason, great, but it seems overkill just for a fixed-length list

commented

I have indeed occasionally wanted tuple types for other reasons.