Re: Does D have anything like the generators of Python and some other languages?

2016-08-30 Thread A D dev via Digitalmars-d-learn

On Tuesday, 30 August 2016 at 00:57:05 UTC, Meta wrote:

There's a Generator class in std.concurrency. I haven't used



https://dlang.org/phobos/std_concurrency.html#.Generator



Thanks, Meta.



Re: Does D have anything like the generators of Python and some other languages?

2016-08-29 Thread Meta via Digitalmars-d-learn

On Monday, 29 August 2016 at 21:24:52 UTC, A D dev wrote:


Hi group,

Does D have anything like the generators of Python and some 
other languages?


Thanks.


There's a Generator class in std.concurrency. I haven't used 
Python all that much so I can't say for certain whether it is the 
same or not.


https://dlang.org/phobos/std_concurrency.html#.Generator


Re: Does D have anything like the generators of Python and some other languages?

2016-08-29 Thread A D dev via Digitalmars-d-learn

On Monday, 29 August 2016 at 22:03:35 UTC, Ali Çehreli wrote:

Here is an example of a generator fiber:


Thanks, will take a look.




Re: Does D have anything like the generators of Python and some other languages?

2016-08-29 Thread Ali Çehreli via Digitalmars-d-learn

On 08/29/2016 02:50 PM, A D dev wrote:

On Monday, 29 August 2016 at 21:28:15 UTC, Cauterite wrote:

Ranges serve some of the purposes that generators are often used for:
http://dlang.org/phobos/std_range.html

But you can of course make true coroutine-based generators with
fibres: http://dlang.org/phobos/core_thread.html#.Fiber


Thanks. Both sound interesting. Will check.



Here is an example of a generator fiber:


http://ddili.org/ders/d.en/fibers.html#ix_fibers.Generator,%20std.concurrency

Ali



Re: Does D have anything like the generators of Python and some other languages?

2016-08-29 Thread A D dev via Digitalmars-d-learn

On Monday, 29 August 2016 at 21:28:15 UTC, Cauterite wrote:
Ranges serve some of the purposes that generators are often 
used for: http://dlang.org/phobos/std_range.html


But you can of course make true coroutine-based generators with 
fibres: http://dlang.org/phobos/core_thread.html#.Fiber


Thanks. Both sound interesting. Will check.



Re: Does D have anything like the generators of Python and some other languages?

2016-08-29 Thread Cauterite via Digitalmars-d-learn

On Monday, 29 August 2016 at 21:24:52 UTC, A D dev wrote:


Hi group,

Does D have anything like the generators of Python and some 
other languages?


Thanks.


Ranges serve some of the purposes that generators are often used 
for: http://dlang.org/phobos/std_range.html


But you can of course make true coroutine-based generators with 
fibres: http://dlang.org/phobos/core_thread.html#.Fiber


"fibre" is basically a synonym of "coroutine".


Does D have anything like the generators of Python and some other languages?

2016-08-29 Thread A D dev via Digitalmars-d-learn


Hi group,

Does D have anything like the generators of Python and some other 
languages?


Thanks.