It is terrible to use a function of std.range if you are not
using "auto" as type all the time.
Why isn't there a convert function for the original type?
I know "array(Range)" of std.array is what i want, but why do i
have to import two modules to use one?
Wouldn't it be better if std.range im
On Saturday, June 30, 2012 01:43:44 Namespace wrote:
> It is terrible to use a function of std.range if you are not
> using "auto" as type all the time.
> Why isn't there a convert function for the original type?
> I know "array(Range)" of std.array is what i want, but why do i
> have to import two
std.range already publicly import std.array.
Oh, good to known.
Not to mention, if you're using ranges heavily, it's not all
that uncommon to
not actually need std.array.array very often. In general, if
you're constantly
converting ranges to arrays, then I'd argue that you're doing
somethi
On Saturday, June 30, 2012 11:06:06 Namespace wrote:
> But a Range don't match any function that accept arrays. Or
> should i prefer to use Ranges instead of arrays?
In general, functions should take ranges, not arrays. They're far more flexible
that way. Requiring an array is generally overly re
Namespace:
Or should i prefer to use Ranges instead of arrays?
There is no short answer to this question. Arrays and lazy ranges
have different qualities, so they are better for different
situations. Arrays use more memory, but in some situations they
are faster. Lazy ranges can be a little
int[] arr = [1, 2, 3];
auto r = iota(4, 10);
// ???
assert(equal(arr, iota(1, 10)));
Hopefully in one GC allocation (assuming we know the range's
length).
I tried std.range.primitives.put but its behavior seems a little
mysterious:
This compiles but asserts at runtime:
int[] arr = [1, 2, 3
std.range.chain?
Atila
On Saturday, 23 May 2015 at 07:03:35 UTC, Vladimir Panteleev
wrote:
int[] arr = [1, 2, 3];
auto r = iota(4, 10);
// ???
assert(equal(arr, iota(1, 10)));
Hopefully in one GC allocation (assuming we know the range's
length).
I tried std.range.primitives.put but its beh
On Saturday, May 23, 2015 07:03:33 Vladimir Panteleev via Digitalmars-d-learn
wrote:
> int[] arr = [1, 2, 3];
> auto r = iota(4, 10);
> // ???
> assert(equal(arr, iota(1, 10)));
>
> Hopefully in one GC allocation (assuming we know the range's
> length).
>
> I tried std.range.primitives.put but its
On Saturday, 23 May 2015 at 08:35:45 UTC, weaselcat wrote:
On Saturday, 23 May 2015 at 07:03:35 UTC, Vladimir Panteleev
wrote:
int[] arr = [1, 2, 3];
auto r = iota(4, 10);
// ???
assert(equal(arr, iota(1, 10)));
import std.array : array;
arr ~ r.array;
woops, meant ~=
but this is probably f
On Saturday, 23 May 2015 at 07:03:35 UTC, Vladimir Panteleev
wrote:
int[] arr = [1, 2, 3];
auto r = iota(4, 10);
// ???
assert(equal(arr, iota(1, 10)));
import std.array : array;
arr ~ r.array;
On Saturday, May 23, 2015 08:36:47 weaselcat via Digitalmars-d-learn wrote:
> On Saturday, 23 May 2015 at 08:35:45 UTC, weaselcat wrote:
> > On Saturday, 23 May 2015 at 07:03:35 UTC, Vladimir Panteleev
> > wrote:
> >> int[] arr = [1, 2, 3];
> >> auto r = iota(4, 10);
> >> // ???
> >> assert(equal(a
On 5/23/15 4:27 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Saturday, May 23, 2015 07:03:33 Vladimir Panteleev via Digitalmars-d-learn
wrote:
int[] arr = [1, 2, 3];
auto r = iota(4, 10);
// ???
assert(equal(arr, iota(1, 10)));
Hopefully in one GC allocation (assuming we know the ran
On Sunday, May 24, 2015 22:13:25 Steven Schveighoffer via Digitalmars-d-learn
wrote:
> On 5/23/15 4:27 AM, Jonathan M Davis via Digitalmars-d-learn wrote:
> > On Saturday, May 23, 2015 07:03:33 Vladimir Panteleev via
> > Digitalmars-d-learn wrote:
> >> int[] arr = [1, 2, 3];
> >> auto r = iota(4,
On Saturday, 23 May 2015 at 07:03:35 UTC, Vladimir Panteleev
wrote:
int[] arr = [1, 2, 3];
auto r = iota(4, 10);
// ???
assert(equal(arr, iota(1, 10)));
Hopefully in one GC allocation (assuming we know the range's
length).
I tried std.range.primitives.put but its behavior seems a
little myst
14 matches
Mail list logo