Re: iota where step is a function

2023-05-24 Thread Ben Jones via Digitalmars-d-learn

On Thursday, 25 May 2023 at 00:39:02 UTC, anonymouse wrote:


I think I misunderstood what was being asked here.


My particular use case is to step using * rather than +, so 
something like for(i = 1; i < N; i *= 2).  `sequence` worked for 
what I was doing well enough


Re: iota where step is a function

2023-05-24 Thread anonymouse via Digitalmars-d-learn

On Thursday, 25 May 2023 at 00:18:44 UTC, anonymouse wrote:

On Wednesday, 24 May 2023 at 16:39:36 UTC, Ben Jones wrote:
Is there a range like iota in phobos where step is a function? 
 I want to specify begin/end and have the "step" be next = 
fun(prev).  Should be easy to write, but don't want to 
reinvent the wheel.

D
import std.stdio;
import std.range: iota;

void main()
{
iota(10, 0, -1).writeln;
}



I think I misunderstood what was being asked here.


Re: request assistance resolving a std.net.curl segmentation fault

2023-05-24 Thread anonymouse via Digitalmars-d-learn

On Saturday, 20 May 2023 at 09:20:54 UTC, kdevel wrote:


What if the internet connection is not re-established within an 
reasonable amount of time? What if the resource is no longer 
available on the server (HTTP eror 404 [1])? If there is an 
interactive user: Wouldn't it be better have the user restart 
the download at his discretion?


I am the interactive user but I'm usually not on site to monitor 
it while this is happening.



What would have been a better approach?


That depends on where you want to use that download function. 
If it is intended to download a full software update of a 
modern e-vehicle I would suggest not to use such an endless 
loop. I would limit the retries to a low single-digit number 
greater than one and of log the event.


Noted.


```
ubyte [] buf;
curl.set (CurlOption.errorbuffer, buf.ptr);
```

to store that result.


Okay. Got it. Thank you.


Re: iota where step is a function

2023-05-24 Thread anonymouse via Digitalmars-d-learn

On Wednesday, 24 May 2023 at 16:39:36 UTC, Ben Jones wrote:
Is there a range like iota in phobos where step is a function?  
I want to specify begin/end and have the "step" be next = 
fun(prev).  Should be easy to write, but don't want to reinvent 
the wheel.

D
import std.stdio;
import std.range: iota;

void main()
{
iota(10, 0, -1).writeln;
}



Re: Best way to use C library

2023-05-24 Thread Maximilian Naderer via Digitalmars-d-learn

On Monday, 22 May 2023 at 22:22:50 UTC, Theo wrote:
On Friday, 19 May 2023 at 18:31:45 UTC, Maximilian Naderer 
wrote:


..
I’m hope somebody could give me some insights. Thank you !

Kind regards from Austria
Max


DConf Online '22 - Translating C to D (Dennis Korpel)

https://www.youtube.com/watch?v=654rSPaIA0o


Thank you very much for the insights so far. I'll check them all 
out!


BR,
Max


Re: iota where step is a function

2023-05-24 Thread Rene Zwanenburg via Digitalmars-d-learn

On Wednesday, 24 May 2023 at 16:39:36 UTC, Ben Jones wrote:
Is there a range like iota in phobos where step is a function?  
I want to specify begin/end and have the "step" be next = 
fun(prev).  Should be easy to write, but don't want to reinvent 
the wheel.


I think you’re looking for either recurrence() or sequence(), 
also defined in std.range.


Re: How to use Dub and Digger to build Pull Requests?

2023-05-24 Thread Quirin Schroll via Digitalmars-d-learn

On Tuesday, 23 May 2023 at 13:52:15 UTC, Vladimir Panteleev wrote:

On Tuesday, 23 May 2023 at 13:50:09 UTC, Quirin Schroll wrote:

```
object.Exception@%LOCALAPPDATA%\dub\packages\ae-0.0.3236\ae\sys\d\manager.d(898): Command ["make", "-f", 
"win32.mak", "MODEL=32", 
"HOST_DC=C:\\Users\\qschroll\\Documents\\d\\mydmd\\work\\dl\\dmd-2.079.0\\dmd2/windows/bin\\dmd.exe", "dmd"] failed 
with status 1
```


This shows that the build failed, but you will have to look 
above this line to see why.


I got what I wanted using [`dmd 
-i`](https://forum.dlang.org/post/ltpjhrigitsizepwc...@forum.dlang.org) instead of digger.


Re: How to use Dub and Digger to build Pull Requests?

2023-05-24 Thread Danny Arends via Digitalmars-d-learn

On Tuesday, 23 May 2023 at 13:51:29 UTC, Quirin Schroll wrote:

On Tuesday, 23 May 2023 at 13:50:09 UTC, Quirin Schroll wrote:

The dlang-bot writes a message to every PR:

 Testing this PR locally

If you don't have a local development environment setup, you 
can use Digger to test this PR:

```bash
dub run digger -- build "master + dmd#<>"
```


I installed the current DMD (version 2.103.1) and executed the 
above command; I’m getting the following error:


For the record, I tried multiple PRs and plain `"master"`. It 
doesn’t seem to be related to the particular PR.


Seems to be a version conflict...
You mentioned that you used: version 2.103.1
However the DMD being called is in:

Documents\\d\\mydmd\\work\\dl\\dmd-2.079.0

so it seems to be 2.079.0