Bug 16282 – Partial permutation/nextPermutation in std.algorithm

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-07-14T19:27:12Z
Last change time
2024-12-01T16:27:30Z
Assigned to
No Owner
Creator
Wyatt
Moved to GitHub: phobos#9689 →

Comments

Comment #0 by wyatt.epp — 2016-07-14T19:27:12Z
It'd be nice to have a way to set k for n!/(n - k)! std.algorithm.sorting.nextPermutation gives unique permutations (which is nice), but it modifies in-place and returns a boolean. (Also, why is it in sorting?) std.algorithm.iteration.permutations actually returns the permutations, but doesn't look for uniqueness AND has no other settings.
Comment #1 by greeenify — 2016-07-18T17:41:40Z
Does maybe mir.combinatorics help you? http://docs.mir.dlang.io/latest/mir_combinatorics.html I once tried to push for that to be included into Phobos, but there was too much resistance. I hope eventually we can move combinatorial back to Phobos. For more details: https://github.com/dlang/phobos/pull/4026 My argument at that time was that e.g. Python's itertools.product has 160K uses on github.
Comment #2 by wyatt.epp — 2016-07-19T22:03:44Z
I guess it might? It looks about how I had envisioned it, but I'm not really jazzed about the idea of installing an entire mathematics package for a one-off script I was expecting to take fifteen minutes. As for the reasoning, I just figured this was obvious? I mean, there probably isn't an introductory text on permutation that doesn't cover the constrained case.
Comment #3 by greeenify — 2016-07-20T00:01:21Z
> It looks about how I had envisioned it, but I'm not really jazzed about the idea of installing an entire mathematics package for a one-off script I was expecting to take fifteen minutes. Do you know about the new inline dub header? At least that's the tradeoff I am taking at the moment. #!/usr/bin/env dub /+ dub.sdl: name "foo" dependency "mir" version="0.15.3" +/ In any case I recommend making a bit of fuzz at the NG (forum.dlang.org) as this thread isn't monitored by many people. D developers are actually quite responsive to constructive feedback :) > As for the reasoning, I just figured this was obvious? Yes, when I needed it I was shocked too and thus wrote the small combinatorics module :/
Comment #4 by robert.schadek — 2024-12-01T16:27:30Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9689 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB