On Saturday, 29 May 2021 at 19:55:30 UTC, Elmar wrote:
In many or most of the cases the use case doesn't actually
require GC-allocation.
Btw, I'm talking about core-level and systems software which
concentrates on data transformations.
When I only want to access a data structure but not
On Wednesday, 26 May 2021 at 15:07:12 UTC, Jack wrote:
On Wednesday, 26 May 2021 at 13:58:56 UTC, Elmar wrote:
On Saturday, 8 December 2018 at 03:51:02 UTC, Adam D. Ruppe
wrote:
[...]
That's amazing, this should be one thing that should appear in
every tutorial just right at the start! I
On Wednesday, 26 May 2021 at 13:58:56 UTC, Elmar wrote:
This example will not compile:
```
auto starts = arr[0..$].stride(2);
auto ends = arr[1..$].stride(2);
randomNumbers[] = ends[] - starts[];
```
Because `[]` is not defined for the Result range. Is there a
standard
On 5/26/21 8:07 AM, Jack wrote:
maybe array from std.array to make that range in array of its own?
Yes, something like this:
import std;
void main() {
auto arr = 10.iota.map!(i => uniform(0, 100));
auto starts = arr[0..$].stride(2);
auto ends = arr[1..$].stride(2);
auto
On Wednesday, 26 May 2021 at 13:58:56 UTC, Elmar wrote:
On Saturday, 8 December 2018 at 03:51:02 UTC, Adam D. Ruppe
wrote:
[...]
That's amazing, this should be one thing that should appear in
every tutorial just right at the start! I was looking hours for
a way to generate an "iterator" (a
On Saturday, 8 December 2018 at 03:51:02 UTC, Adam D. Ruppe wrote:
On Saturday, 8 December 2018 at 03:48:10 UTC, Murilo wrote:
Try passing `ps[]` to the function instead of plain `ps` and
see what happens.
How do I transform an array into a range?
With the slicing operator, [].
That's
Hi guys, thank you for helping me out here, there is this
facebook group for the D language, here we can help and teach
each other. It is called Programming in D. Please join.
https://www.facebook.com/groups/662119670846705/?ref=bookmarks
On 12/7/18 11:16 PM, Adam D. Ruppe wrote:
On Saturday, 8 December 2018 at 04:11:03 UTC, Murilo wrote:
What is the difference between declaring "int[3] a = [1,2,3];" and
declaring "int[] a = [1,2,3];"? Is the first an array and the second a
range?
They are both arrays, just the former one has
On Saturday, 8 December 2018 at 04:16:25 UTC, Adam D. Ruppe wrote:
On Saturday, 8 December 2018 at 04:11:03 UTC, Murilo wrote:
What is the difference between declaring "int[3] a = [1,2,3];"
and declaring "int[] a = [1,2,3];"? Is the first an array and
the second a range?
They are both
On Saturday, 8 December 2018 at 04:11:03 UTC, Murilo wrote:
What is the difference between declaring "int[3] a = [1,2,3];"
and declaring "int[] a = [1,2,3];"? Is the first an array and
the second a range?
They are both arrays, just the former one has a fixed size and
the latter does not.
On Saturday, 8 December 2018 at 03:51:02 UTC, Adam D. Ruppe wrote:
On Saturday, 8 December 2018 at 03:48:10 UTC, Murilo wrote:
Try passing `ps[]` to the function instead of plain `ps` and
see what happens.
How do I transform an array into a range?
With the slicing operator, [].
Thank you
On Friday, December 7, 2018 8:46:11 PM MST Adam D. Ruppe via Digitalmars-d-
learn wrote:
> On Saturday, 8 December 2018 at 03:37:56 UTC, Murilo wrote:
> > Hi guys, I have created an array of strings with "string[12] ps
>
> string[12] isn't a range, but string[] is.
>
> Try passing `ps[]` to the
On Saturday, 8 December 2018 at 03:48:10 UTC, Murilo wrote:
Try passing `ps[]` to the function instead of plain `ps` and
see what happens.
How do I transform an array into a range?
With the slicing operator, [].
On Saturday, 8 December 2018 at 03:37:56 UTC, Murilo wrote:
Hi guys, I have created an array of strings with "string[12] ps
string[12] isn't a range, but string[] is.
Try passing `ps[]` to the function instead of plain `ps` and see
what happens.
On Saturday, 8 December 2018 at 03:46:11 UTC, Adam D. Ruppe wrote:
On Saturday, 8 December 2018 at 03:37:56 UTC, Murilo wrote:
Hi guys, I have created an array of strings with "string[12] ps
string[12] isn't a range, but string[] is.
Try passing `ps[]` to the function instead of plain `ps`
Hi guys, I have created an array of strings with "string[12] ps =
["cat", "dog", "lion", "wolf", "coin", "chest", "money", "gold",
"A", "B", "C", "D"];".
I want to use the array as a range and I want to randomize it,
like I want to transform that into several other ranges with the
same
On Tuesday, October 11, 2016 10:42:42 Ali Çehreli via Digitalmars-d-learn
wrote:
> Those interfaces already exist in Phobos: :)
>
>https://dlang.org/phobos/std_range_interfaces.html
>
> auto foo(int[] ints) {
>import std.range;
>if (ints.length > 10) {
>return
>
On Tuesday, 11 October 2016 at 18:09:26 UTC, ag0aep6g wrote:
You've got some options:
Wow, thanks everyone, great information! I think I understand my
options now.
On 10/11/2016 09:55 AM, orip wrote:
auto foo(int[] ints) {
import std.range;
if (ints.length > 10) {
return chain(ints[0..5], ints[8..$]);
} else {
//return ints; // Error: mismatched function return type inference
of int[] and Result
return chain(ints[0..0], ints[0..$]); //
On Tuesday, October 11, 2016 07:55:36 orip via Digitalmars-d-learn wrote:
> I get "Error: mismatched function return type inference" errors
> with choosing the return type for functions that work on ranges
> using, e.g, std.algorithm or std.range functions, but have
> different behavior based on
On 10/11/2016 10:28 AM, TheFlyingFiddle wrote:
On Tuesday, 11 October 2016 at 15:46:20 UTC, orip wrote:
On Tuesday, 11 October 2016 at 13:06:37 UTC, pineapple wrote:
Rewrite `return chain(ints[0..5], ints[8..$]);` as `return ints[0..5]
~ ints[8..$];`
The `chain` function doesn't return an
On Tuesday, 11 October 2016 at 15:46:20 UTC, orip wrote:
On Tuesday, 11 October 2016 at 13:06:37 UTC, pineapple wrote:
Rewrite `return chain(ints[0..5], ints[8..$]);` as `return
ints[0..5] ~ ints[8..$];`
The `chain` function doesn't return an array, it returns a
lazily-evaluated sequence of
11.10.2016 18:46, orip пишет:
On Tuesday, 11 October 2016 at 13:06:37 UTC, pineapple wrote:
Rewrite `return chain(ints[0..5], ints[8..$]);` as `return ints[0..5]
~ ints[8..$];`
The `chain` function doesn't return an array, it returns a
lazily-evaluated sequence of an entirely different type
On Tuesday, 11 October 2016 at 13:06:37 UTC, pineapple wrote:
Rewrite `return chain(ints[0..5], ints[8..$]);` as `return
ints[0..5] ~ ints[8..$];`
The `chain` function doesn't return an array, it returns a
lazily-evaluated sequence of an entirely different type from
`int[]`.
Of course it
On Tuesday, 11 October 2016 at 07:55:36 UTC, orip wrote:
I get "Error: mismatched function return type inference" errors
with choosing the return type for functions that work on ranges
using, e.g, std.algorithm or std.range functions, but have
different behavior based on runtime values. The
I get "Error: mismatched function return type inference" errors
with choosing the return type for functions that work on ranges
using, e.g, std.algorithm or std.range functions, but have
different behavior based on runtime values. The return type is
always a range with the same underlying
26 matches
Mail list logo