Re: array operations and ranges

2015-05-02 Thread Manu via Digitalmars-d
) are map!(e=...), and that's a lot of boilerplate surrounding '...', obscuring the actual operation. I also find the paren nesting gets pretty deep (for instance, the map above) and the code is harder to follow than a traditional foreach loop. If we can do normal array operations on ranges

Re: array operations and ranges

2015-04-30 Thread Walter Bright via Digitalmars-d
On 4/26/2015 3:17 AM, Manu via Digitalmars-d wrote: Array operations are super cool, and I'm using ranges (which kinda look and feel like arrays) more and more these days, but I can't help but feel like their incompatibility with the standard array operations is a massive loss. Let's say I want

Re: array operations and ranges

2015-04-27 Thread John Colvin via Digitalmars-d
can implement it. Lowering array operations to lazy ranges seems like a huge can of worms. Not so keen. Lazy array ops are great, but I don't see it working out as a builtin feature unless it had it's own syntax.

Re: array operations and ranges

2015-04-27 Thread Vlad Levenfeld via Digitalmars-d
On Monday, 27 April 2015 at 06:52:11 UTC, Manu wrote: On 27 April 2015 at 15:58, Vlad Levenfeld via Digitalmars-d digitalmars-d@puremagic.com wrote: Phobos containers already support the first line, and it would be a natural extension to make them support the second. Sure, it's not

Re: array operations and ranges

2015-04-27 Thread Manu via Digitalmars-d
On 27 April 2015 at 15:58, Vlad Levenfeld via Digitalmars-d digitalmars-d@puremagic.com wrote: Phobos containers already support the first line, and it would be a natural extension to make them support the second. Sure, it's not complicated. It's something I had done in this other code and

Re: array operations and ranges

2015-04-27 Thread Vlad Levenfeld via Digitalmars-d
Phobos containers already support the first line, and it would be a natural extension to make them support the second. Sure, it's not complicated. It's something I had done in this other code and showing for example.

Re: array operations and ranges

2015-04-27 Thread via Digitalmars-d
On Monday, 27 April 2015 at 06:52:11 UTC, Manu wrote: On 27 April 2015 at 15:58, Vlad Levenfeld via Digitalmars-d digitalmars-d@puremagic.com wrote: Phobos containers already support the first line, and it would be a natural extension to make them support the second. Sure, it's not

Re: array operations and ranges

2015-04-27 Thread Manu via Digitalmars-d
(and opSliceOpAssign) understanding ranges as source operands is a good idea. I might even see if I can implement it. Lowering array operations to lazy ranges seems like a huge can of worms. Not so keen. Lazy array ops are great, but I don't see it working out as a builtin feature unless it had

Re: array operations and ranges

2015-04-26 Thread Laeeth Isharc via Digitalmars-d
On Sunday, 26 April 2015 at 10:17:59 UTC, Manu wrote: Array operations are super cool, and I'm using ranges (which kinda look and feel like arrays) more and more these days, but I can't help but feel like their incompatibility with the standard array operations is a massive loss. Let's say I

array operations and ranges

2015-04-26 Thread Manu via Digitalmars-d
Array operations are super cool, and I'm using ranges (which kinda look and feel like arrays) more and more these days, but I can't help but feel like their incompatibility with the standard array operations is a massive loss. Let's say I want to assign one range to another: b[] = a[]; It's not

Re: array operations and ranges

2015-04-26 Thread Manu via Digitalmars-d
Naturally, where I wrote: float[] a = b.transform[]; I meant: float[N] a = b.transform[]; // -- on the stack On 26 April 2015 at 20:17, Manu turkey...@gmail.com wrote: Array operations are super cool, and I'm using ranges (which kinda look and feel like arrays) more and more these days, but I

Re: array operations and ranges

2015-04-26 Thread Vlad Levenfeld via Digitalmars-d
On Sunday, 26 April 2015 at 10:17:59 UTC, Manu wrote: I find that my lazy ranges often end up on the stack, but I can't assign/initialise directly: float[] a = b.transform[]; Instead I need to: float[] a; b.transform.copy(a[]); To enable the first line, builtin arrays would need to be able

Re: array operations and ranges

2015-04-26 Thread Vlad Levenfeld via Digitalmars-d
Manu, I just saw your other post clarifying the code was float[N] a = ..., not float[] a. That changes things a bit. I just implemented a static array type in the lib (1-d only for now) which can do the following: unittest { import std.range: only; StaticArray!(int, 2) x;

Re: array operations and ranges

2015-04-26 Thread Jakob Ovrum via Digitalmars-d
On Sunday, 26 April 2015 at 18:48:15 UTC, Vlad Levenfeld wrote: I've got a lib to enable this syntax: Array!float a = b[].transform_1; a[i..j] = c[x..y].transform_2; Phobos containers already support the first line, and it would be a natural extension to make them support the second.