I have a bit of code:
string[] returnValue;
foreach(string key, string[] value; groups) {
returnValue ~=
value.sort!debianPackageNumberComparator()[0..$-1].array;
}
return returnValue;
which does seem to do the thing required, but this sort of code
On Friday, 17 March 2017 at 17:13:48 UTC, Russel Winder wrote:
I have a bit of code:
string[] returnValue;
foreach(string key, string[] value; groups) {
returnValue ~=
value.sort!debianPackageNumberComparator()[0..$-1].array;
}
return returnValue;
[...]
You
On 03/17/2017 10:51 AM, Jerry wrote:
On Friday, 17 March 2017 at 17:13:48 UTC, Russel Winder wrote:
I have a bit of code:
string[] returnValue;
foreach(string key, string[] value; groups) {
returnValue ~=
value.sort!debianPackageNumberComparator()[0..$-1].array;
}
return
On Fri, 2017-03-17 at 17:51 +, Jerry via Digitalmars-d-learn wrote:
> On Friday, 17 March 2017 at 17:13:48 UTC, Russel Winder wrote:
> > I have a bit of code:
> >
> > string[] returnValue;
> > foreach(string key, string[] value; groups) {
> > returnValue ~=
> > value.sort!
On Friday, 17 March 2017 at 19:08:36 UTC, Russel Winder wrote:
On Fri, 2017-03-17 at 17:51 +, Jerry via
Digitalmars-d-learn wrote:
On Friday, 17 March 2017 at 17:13:48 UTC, Russel Winder wrote:
> I have a bit of code:
>
> string[] returnValue;
>foreach(string key, string[] value; grou
On Fri, 2017-03-17 at 19:21 +, John Colvin via Digitalmars-d-learn
wrote:
> […]
>
> reduce is a free function in std.algorithm. Just import it and
> you're away. Anyway, is this what you wanted?
>
> string[] blah(string[][string] groups)
> {
> import std.algorithm : map, joiner;
>
On 03/17/2017 12:21 PM, John Colvin wrote:
> On Friday, 17 March 2017 at 19:08:36 UTC, Russel Winder wrote:
>> Rust ownership problems
>> seem to be a doddle compared to this problem.
It sometimes feels like that but we don't want to lose you. :)
> reduce is a free function in std.algorithm. Ju
On Fri, Mar 17, 2017 at 07:21:50PM +, John Colvin via Digitalmars-d-learn
wrote:
[...]
> reduce is a free function in std.algorithm. Just import it and you're
> away.
[...]
Also, there is now a variant of reduce called `fold`, that has a nicer
order of parameters, i.e., you can use it in UFCS
On Fri, 2017-03-17 at 12:29 -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
>
[…]
> Also, there is now a variant of reduce called `fold`, that has a
> nicer
> order of parameters, i.e., you can use it in UFCS chains:
>
> myData.map!(a => transform(a))
> .fold!((a,b) => a + b)(0
On Fri, 2017-03-17 at 12:32 -0700, Ali Çehreli via Digitalmars-d-learn
wrote:
> On 03/17/2017 12:21 PM, John Colvin wrote:
> > On Friday, 17 March 2017 at 19:08:36 UTC, Russel Winder wrote:
>
> >> Rust ownership problems
> >> seem to be a doddle compared to this problem.
>
> It sometimes feels
On Saturday, 18 March 2017 at 11:09:34 UTC, Russel Winder wrote:
Is this foldr or foldl' ?
It's a left fold of course, having foldr by default in eager
language would be awkward.
On Sat, 2017-03-18 at 11:38 +, thedeemon via Digitalmars-d-learn
wrote:
> On Saturday, 18 March 2017 at 11:09:34 UTC, Russel Winder wrote:
> > Is this foldr or foldl' ?
>
> It's a left fold of course, having foldr by default in eager
> language would be awkward.
I would expect foldl, but the
12 matches
Mail list logo