Re: Range handling difficulties

2024-04-24 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Apr 24, 2024 at 08:08:06AM +, Menjanahary R. R. via Digitalmars-d-learn wrote: > I tried to solve Project Euler [problem > #2](https://projecteuler.net/problem=2) using > [Recurrence/recurrence](https://dlang.org/library/std/range/recurrence.html). > > Assuming `genEvenFibonacci` is

Re: mmap file performance

2024-04-24 Thread Patrick Schluter via Digitalmars-d-learn
On Monday, 15 April 2024 at 16:13:41 UTC, Andy Valencia wrote: On Monday, 15 April 2024 at 08:05:25 UTC, Patrick Schluter wrote: The setup of a memory mapped file is relatively costly. For smaller files it is a net loss and read/write beats it hands down. Interestingly, this performance

Recommendations on porting Python to D

2024-04-24 Thread Chris Piker via Digitalmars-d-learn
Hi D I have a somewhat extensive CGI based web service written in Python and I'd like to port it to D. I can do this manually of course, and maybe that's the best way, but for a rough start, is anyone aware of any tools that generate an abstract syntax tree which could then be converted to

Re: Recommendations on porting Python to D

2024-04-24 Thread Lance Bachmeier via Digitalmars-d-learn
On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote: is anyone aware of any tools that generate an abstract syntax tree which could then be converted to somewhat equivalent D code? This might give me a jump-start on the manual conversion process. Then later I can work on removing

Re: Range handling difficulties

2024-04-24 Thread Menjanahary R. R. via Digitalmars-d-learn
On Wednesday, 24 April 2024 at 14:22:10 UTC, H. S. Teoh wrote: On Wed, Apr 24, 2024 at 08:08:06AM +, Menjanahary R. R. via Digitalmars-d-learn wrote: [...] evenfib.until!(n => n > 4_000_000).sum.writeln; T Thanks a lot! You've made my day 

Re: Recommendations on porting Python to D

2024-04-24 Thread Tim via Digitalmars-d-learn
On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote: I have a somewhat extensive CGI based web service written in Python and I'd like to port it to D. I can do this manually of course, and maybe that's the best way, but for a rough start, is anyone aware of any tools that generate

Re: Print debug data

2024-04-24 Thread mw via Digitalmars-d-learn
On Monday, 17 July 2023 at 03:43:04 UTC, Alain De Vos wrote: Is it possible to print runtime memory usage of: -The stack -The heap -The garbage collector ? And how to print the memory stats of each class / struct type? 

Re: Recommendations on porting Python to D

2024-04-24 Thread Sergey via Digitalmars-d-learn
On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote: Hi D I have a somewhat extensive CGI based web service written in There is also https://code.dlang.org/packages/arsd-official%3Acgi

Re: Adapting foreign iterators to D ranges

2024-04-24 Thread cc via Digitalmars-d-learn
On Wednesday, 24 April 2024 at 05:08:25 UTC, Salih Dincer wrote: Yes, `opApply()` works! You just need to use `do while()` instead of `while()` because it skips the first item. It depends on the type of structure being consumed, if it provides "next" as a direct pointer then yeah you would

Re: Recommendations on porting Python to D

2024-04-24 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 24 April 2024 at 20:13:26 UTC, Lance Bachmeier wrote: I haven't used Python much in recent years, but my recollection is that Python 2 had an ast module that would spit out the ast for you. Thanks for the pointer! So I ran one of my modules through and generated an AST, and get

Range handling difficulties

2024-04-24 Thread Menjanahary R. R. via Digitalmars-d-learn
I tried to solve Project Euler [problem #2](https://projecteuler.net/problem=2) using [Recurrence/recurrence](https://dlang.org/library/std/range/recurrence.html). Assuming `genEvenFibonacci` is the appropriate funtion in Explicit form, I got what I need like so: ``` auto evenfib =