Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpose of jagged array #86

Open
pzp1997 opened this issue Dec 18, 2017 · 2 comments
Open

Transpose of jagged array #86

pzp1997 opened this issue Dec 18, 2017 · 2 comments

Comments

@pzp1997
Copy link
Contributor

pzp1997 commented Dec 18, 2017

We need to decide on an appropriate way of handling non-rectangular arrays. As @gilberkennen wrote in #83, (some of) the possible options are...

  1. We could wrap the whole thing in a Maybe which fails on different-length lists.
  2. We could wrap individual elements in Maybe, which would be a bit awkward to deal with.
  3. We could truncate the matrix to the shortest list size, which seems a bit surprising, but less surprising than the current functionality and it gives us the nicer type that wouldn't need to change.

As of #83, the behavior aligns with the third option but the implementation can be easily adapted to any of them. The option that I am now leaning towards is to just say in the docs that the output for non-rectangular input is unspecified and can change at any time (although I can definitely see many arguments against that course of action related to maintainability). I am also strongly considering option number 1.

@tuxagon
Copy link

tuxagon commented Mar 2, 2018

@pzp1997 could there be separate implementations? For example,

  • transpose, which follows number 3 and
  • transposeJagged or jaggedTranspose, which follows number 2

@tuxagon
Copy link

tuxagon commented Mar 2, 2018

I threw together a simple example for jagged to get a feel for what it is like to use it. It was my first naive approach, so I'm confident there is something that could be done to improve it.

https://ellie-app.com/dsbC7m3cKa1/0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants