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

Already on GitHub? Sign in to your account

BatList.n_cartesian_product #359

wistery-k opened this Issue Feb 23, 2013 · 3 comments


None yet
2 participants

wistery-k commented Feb 23, 2013

Is there any reason for
BatList.n_cartesian_product [] = assert false
I think [[]] is good (or at least invalid_arg) instead of assert false.


gasche commented Feb 23, 2013

Thanks for your report. It is clear that assert false is wrong: assertion failures are to be used in cases that cannot happen, and in particular it should never, ever be sent back to the user. This is clearly a bug.

After a bit of mathematical thinking, I think the One Right Answer in this case is [[]]. Would you care to provide a patch to change this behavior? BatList.n_cartesian_product currently has no tests at all. In your patch, could you write some unit tests verifying the behavior in the general case, for a list of singleton lists, for a list of a single list, and for the empty list?


wistery-k commented Feb 23, 2013

I sended a pull request. (I'm a github beginner. I'm sorry for anything bad..)


gasche commented Feb 23, 2013

Your contribution closes this bug. Thanks a lot, and I hope you'll find other bugs :-)

@gasche gasche closed this Feb 23, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment