digitalmars.D.learn - Any python-like generator patterns in D?
- Samuel Lampa <samuel.lampa gmail.com> Sep 08 2011
- Ali =?iso-8859-1?q?=C7ehreli?= <acehreli yahoo.com> Sep 08 2011
- Samuel Lampa <samuel.lampa gmail.com> Sep 08 2011
--bcaec517a5fc9742ea04ac6c7367 Content-Type: text/plain; charset=ISO-8859-1 Hi, I found these slides very interesting, on how python generator patterns can be used to create re-usable code-parts that can be "piped" togegher ad infinitum, to create e.g. parsing pipelines requiring minimal memory (things a sysadmin working with huge files might need quite often): http://www.dabeaz.com/generators/index.html PDF: http://www.dabeaz.com/generators/Generators.pdf It would be nice to do this kind of stuff in D though, to hopefully gain some performance, so I wonder, is there similar stuff in D, and where to find info about it? Cheers, Samuel --bcaec517a5fc9742ea04ac6c7367 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,<br><br>I found these slides very interesting, on how python generator p= atterns can be used to create re-usable code-parts that can be "piped&= quot; togegher ad infinitum, to create e.g. parsing pipelines requiring min= imal memory (things a sysadmin working with huge files might need quite oft= en):<br> <br><a href=3D"http://www.dabeaz.com/generators/index.html">http://www.dabe= az.com/generators/index.html</a><br>PDF: <a href=3D"http://www.dabeaz.com/g= enerators/Generators.pdf">http://www.dabeaz.com/generators/Generators.pdf</= a><br> <br>It would be nice to do this kind of stuff in D though, to hopefully gai= n some performance, so I wonder, is there similar stuff in D, and where to = find info about it?<br><br>Cheers,<br>Samuel<br> --bcaec517a5fc9742ea04ac6c7367--
Sep 08 2011
On Thu, 08 Sep 2011 13:35:02 +0200, Samuel Lampa wrote:Hi, I found these slides very interesting, on how python generator patterns can be used to create re-usable code-parts that can be "piped" togegher ad infinitum, to create e.g. parsing pipelines requiring minimal memory (things a sysadmin working with huge files might need quite often): http://www.dabeaz.com/generators/index.html PDF: http://www.dabeaz.com/generators/Generators.pdf It would be nice to do this kind of stuff in D though, to hopefully gain some performance, so I wonder, is there similar stuff in D, and where to find info about it? Cheers, Samuel
D uses the range concept. Phobos ranges are based on the ideas presented in this article: http://www.informit.com/articles/printerfriendly.aspx?p=1407357 But some of the design and even the names of range types have changed since that article has been written. These and other Phobos modules make use of ranges: http://www.d-programming-language.org/phobos/std_range.html http://www.d-programming-language.org/phobos/std_algorithm.html http://www.d-programming-language.org/phobos/std_array.html Ali P.S. I am in the process of translating my Turkish D book to English. For completeness, here are the two chapters about ranges: http://ddili.org/ders/d/araliklar.html http://ddili.org/ders/d/araliklar_baska.html
Sep 08 2011
Many thanks! I'll check these links. // Samuel On 09/08/2011 07:47 PM, Ali Çehreli wrote:On Thu, 08 Sep 2011 13:35:02 +0200, Samuel Lampa wrote:Hi, I found these slides very interesting, on how python generator patterns can be used to create re-usable code-parts that can be "piped" togegher ad infinitum, to create e.g. parsing pipelines requiring minimal memory (things a sysadmin working with huge files might need quite often): http://www.dabeaz.com/generators/index.html PDF: http://www.dabeaz.com/generators/Generators.pdf It would be nice to do this kind of stuff in D though, to hopefully gain some performance, so I wonder, is there similar stuff in D, and where to find info about it? Cheers, Samuel
in this article: http://www.informit.com/articles/printerfriendly.aspx?p=1407357 But some of the design and even the names of range types have changed since that article has been written. These and other Phobos modules make use of ranges: http://www.d-programming-language.org/phobos/std_range.html http://www.d-programming-language.org/phobos/std_algorithm.html http://www.d-programming-language.org/phobos/std_array.html Ali P.S. I am in the process of translating my Turkish D book to English. For completeness, here are the two chapters about ranges: http://ddili.org/ders/d/araliklar.html http://ddili.org/ders/d/araliklar_baska.html
Sep 08 2011









Ali =?iso-8859-1?q?=C7ehreli?= <acehreli yahoo.com> 