digitalmars.D.learn - No trace of cumulativeFold except in the source.
- e-y-e (15/15) Oct 23 2016 Recently I needed to use a cumulative sum function, so I looked
- Jonathan M Davis via Digitalmars-d-learn (6/22) Oct 23 2016 It's not a bug. It's just too new. You looked at the master branch on
- e-y-e (4/12) Oct 23 2016 Ok, that checks out. I looked at the commit and it was in April
- Jonathan M Davis via Digitalmars-d-learn (9/24) Oct 23 2016 Per
- e-y-e (7/18) Oct 23 2016 On this topic, do you think a 'cumulativeSum' specialisation
- Jonathan M Davis via Digitalmars-d-learn (5/10) Oct 27 2016 If you think that it would be generally useful and worth having in Phobo...
Recently I needed to use a cumulative sum function, so I looked in phobos' documentation for 'cumulative' but found nothing useful. Then I looked in the forums for it and found nothing useful. But when I searched phobos for it I found cumulativeFold in std.algorithm.iteration: https://github.com/dlang/phobos/blob/master/std/algorithm/iteration.d#L3127. So I tried this: auto cumulativeSum(Range)(Range r) { import std.algorithm.iteration : cumulativeFold; return r.cumulativeFold!((a, b) => a +b); } but when I run it I get 'Error: module std.algorithm.iteration import 'cumulativeFold' not found'. Anyone can reproduce this? looking at the source I can't see how it could possibly occur but it is certainly a bug right?
Oct 23 2016
On Sunday, October 23, 2016 07:46:19 e-y-e via Digitalmars-d-learn wrote:Recently I needed to use a cumulative sum function, so I looked in phobos' documentation for 'cumulative' but found nothing useful. Then I looked in the forums for it and found nothing useful. But when I searched phobos for it I found cumulativeFold in std.algorithm.iteration: https://github.com/dlang/phobos/blob/master/std/algorithm/iteration.d#L312 7. So I tried this: auto cumulativeSum(Range)(Range r) { import std.algorithm.iteration : cumulativeFold; return r.cumulativeFold!((a, b) => a +b); } but when I run it I get 'Error: module std.algorithm.iteration import 'cumulativeFold' not found'. Anyone can reproduce this? looking at the source I can't see how it could possibly occur but it is certainly a bug right?It's not a bug. It's just too new. You looked at the master branch on github, whereas what you're probably using on your computer is 2.071.2, which does not have cumulativeFold, because it was added at some point after 2.071.2. - Jonathan M Davis
Oct 23 2016
On Sunday, 23 October 2016 at 09:11:08 UTC, Jonathan M Davis wrote:On Sunday, October 23, 2016 07:46:19 e-y-e via Digitalmars-d-learn wrote:Ok, that checks out. I looked at the commit and it was in April so I just assumed it would be in the release by now....It's not a bug. It's just too new. You looked at the master branch on github, whereas what you're probably using on your computer is 2.071.2, which does not have cumulativeFold, because it was added at some point after 2.071.2. - Jonathan M Davis
Oct 23 2016
On Sunday, October 23, 2016 10:10:40 e-y-e via Digitalmars-d-learn wrote:On Sunday, 23 October 2016 at 09:11:08 UTC, Jonathan M Davis wrote:Per http://dlang.org/changelog/2.071.0.html 2.071.0 came out at the beginning of April, and 2.072 has been slow in coming, so we've only had point releases since then, and a new function would not be added with a point release. But yes, per the current release scheme, normally, there would have been a new major release by now (it is finally in beta though). - Jonathan M DavisOn Sunday, October 23, 2016 07:46:19 e-y-e via Digitalmars-d-learn wrote:Ok, that checks out. I looked at the commit and it was in April so I just assumed it would be in the release by now....It's not a bug. It's just too new. You looked at the master branch on github, whereas what you're probably using on your computer is 2.071.2, which does not have cumulativeFold, because it was added at some point after 2.071.2. - Jonathan M Davis
Oct 23 2016
On Sunday, 23 October 2016 at 10:19:07 UTC, Jonathan M Davis wrote:On Sunday, October 23, 2016 10:10:40 e-y-e via Digitalmars-d-learn wrote:On this topic, do you think a 'cumulativeSum' specialisation based on the 'sum' specialisation be welcome in phobos? Here's a quick prototype, obviously not library standard but the basic logic is there: https://gist.github.com/anonymous/4fb79b4aba79b59348273288993740cb...Per http://dlang.org/changelog/2.071.0.html 2.071.0 came out at the beginning of April, and 2.072 has been slow in coming, so we've only had point releases since then, and a new function would not be added with a point release. But yes, per the current release scheme, normally, there would have been a new major release by now (it is finally in beta though). - Jonathan M Davis
Oct 23 2016
On Sunday, October 23, 2016 19:20:43 e-y-e via Digitalmars-d-learn wrote:On this topic, do you think a 'cumulativeSum' specialisation based on the 'sum' specialisation be welcome in phobos? Here's a quick prototype, obviously not library standard but the basic logic is there: https://gist.github.com/anonymous/4fb79b4aba79b59348273288993740cbIf you think that it would be generally useful and worth having in Phobos, by all means, get it up to snuff for inclusion in Phobos and create a PR for it. - Jonathan M Davis
Oct 27 2016