On 06/30/2018 05:17 AM, Steven Schveighoffer wrote:
Isn't this what only does? https://dlang.org/phobos/std_range.html#only
Cool. :)
import std.range : only;
auto t = tuple(5, 3.5, false);
auto r = only(t.expand);
Ali
On 6/29/18 1:35 PM, Ali Çehreli wrote:
On 06/28/2018 11:10 PM, Jonathan M Davis wrote:
> On Friday, June 29, 2018 05:52:03 Alex via Digitalmars-d-learn wrote:
>> Wouldn't this be weird from the semantic view?
I agree with all your concerns. The fact that Meta decided to make the
element type
On 06/28/2018 11:10 PM, Jonathan M Davis wrote:
> On Friday, June 29, 2018 05:52:03 Alex via Digitalmars-d-learn wrote:
>> Wouldn't this be weird from the semantic view?
I agree with all your concerns. The fact that Meta decided to make the
element type Algebraic!T as opposed to my CommonType!T
On Friday, June 29, 2018 05:52:03 Alex via Digitalmars-d-learn wrote:
> On Thursday, 28 June 2018 at 19:02:51 UTC, Ali Çehreli wrote:
> > On 06/28/2018 11:08 AM, Mr.Bingo wrote:
> > > Thanks, why not add the ability to pass through ranges and
> >
> > arrays and
> >
> > > add it to phobos?
> >
> > M
On Thursday, 28 June 2018 at 19:02:51 UTC, Ali Çehreli wrote:
On 06/28/2018 11:08 AM, Mr.Bingo wrote:
> Thanks, why not add the ability to pass through ranges and
arrays and
> add it to phobos?
Makes sense. It needs an enhancement request at
http://issues.dlang.org/, a good implementation, and
On 06/28/2018 11:08 AM, Mr.Bingo wrote:
> Thanks, why not add the ability to pass through ranges and arrays and
> add it to phobos?
Makes sense. It needs an enhancement request at
http://issues.dlang.org/, a good implementation, and a pull request. :)
Ali
On Thursday, 28 June 2018 at 17:00:37 UTC, Mr.Bingo wrote:
I mean, if you think about it, the memory layout of a tuple is
sequential types:
T1
T2
...
So, to popFront a tuple is just changing the starting offset.
You're right; it can definitely be done.
struct TupleRange(T...)
{
size
On Thursday, 28 June 2018 at 18:03:09 UTC, Ali Çehreli wrote:
On 06/28/2018 10:00 AM, Mr.Bingo wrote:
> But is this going to be optimized?
Not our job! :o)
> That is, a tuple is a range!
Similar to the array-slice distinction, tuple is a container,
needing its range.
> It is clearly easy t
On 06/28/2018 10:00 AM, Mr.Bingo wrote:
> But is this going to be optimized?
Not our job! :o)
> That is, a tuple is a range!
Similar to the array-slice distinction, tuple is a container, needing
its range.
> It is clearly easy to see if a tuple is empty, to get the front,
Ok.
> and to
> p
On Thursday, 28 June 2018 at 16:02:59 UTC, Alex wrote:
On Thursday, 28 June 2018 at 14:35:33 UTC, Mr.Bingo wrote:
Seems like it would unify things quite a bit.
Yeah... this is, because you can't popFront on a tuple, as the
amount of entries is fixed. You can, however, popFront on every
range
On Thursday, 28 June 2018 at 14:35:33 UTC, Mr.Bingo wrote:
Seems like it would unify things quite a bit.
Yeah... this is, because you can't popFront on a tuple, as the
amount of entries is fixed. You can, however, popFront on every
range.
But as Timoses wrote you can easily make a range out
On Thursday, 28 June 2018 at 14:35:33 UTC, Mr.Bingo wrote:
Seems like it would unify things quite a bit.
import std.typecons, std.range, std.array, std.algorithm,
std.stdio;
void main()
{
auto t = tuple(3,4,5,6);
//auto t = [3,4,5,6];
writeln(t.map!(a => 3*a).
Seems like it would unify things quite a bit.
import std.typecons, std.range, std.array, std.algorithm,
std.stdio;
void main()
{
auto t = tuple(3,4,5,6);
//auto t = [3,4,5,6];
writeln(t.map!(a => 3*a).sum());
}
13 matches
Mail list logo