How to use ranges?

2015-08-23 Thread Doolan via Digitalmars-d-learn
to use it, just the current amount/layout of documentation can be frustrating at times. Can someone give me a short summary of how to use ranges? And how do they relate to slices? That line is really blurry...

Re: How to use ranges?

2015-08-23 Thread Rikki Cattermole via Digitalmars-d-learn
e D enough to want to use it, just the current amount/layout of documentation can be frustrating at times. Can someone give me a short summary of how to use ranges? And how do they relate to slices? That line is really blurry... Have a read of: https://github.com/rikkimax/twp-d/blob/master/manuscript/content/idioms/ranges.md Let me know what you think :)

Re: How to use ranges?

2015-08-23 Thread Doolan via Digitalmars-d-learn
On Sunday, 23 August 2015 at 10:38:53 UTC, Rikki Cattermole wrote: On 8/23/2015 10:17 PM, Doolan wrote: Have a read of: https://github.com/rikkimax/twp-d/blob/master/manuscript/content/idioms/ranges.md Let me know what you think :) I think I'm a little more confused than before... this says

Re: How to use ranges?

2015-08-23 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/24/2015 12:52 AM, Doolan wrote: On Sunday, 23 August 2015 at 10:38:53 UTC, Rikki Cattermole wrote: On 8/23/2015 10:17 PM, Doolan wrote: Have a read of: https://github.com/rikkimax/twp-d/blob/master/manuscript/content/idioms/ranges.md Let me know what you think :) I think I'm a little mo

Re: How to use ranges?

2015-08-23 Thread anonymous via Digitalmars-d-learn
se typeof to get the type of a range expression when typing it out is impractical/impossible. > Can someone give me a short summary of how to use ranges? I'm not sure what exactly you're looking for. The documentation for tee has some example code. How about you show something y

Re: How to use ranges?

2015-08-23 Thread welkam via Digitalmars-d-learn
There was a talk on ranges in Dconf 2015 https://www.youtube.com/watch?v=A8Btr8TPJ8c&list=PLEDeq48KhndP-mlE-0Bfb_qPIMA4RrrKo&index=10

Re: How to use ranges?

2015-08-23 Thread Doolan via Digitalmars-d-learn
you find out RangeT is private... You can use typeof to get the type of a range expression when typing it out is impractical/impossible. What if I want to save a range in a struct? Or is a range more of a verb than a noun..? Can someone give me a short summary of how to use ranges? I'

Re: How to use ranges?

2015-08-23 Thread John Colvin via Digitalmars-d-learn
Generally, dynamic arrays / slices are random-access ranges. Narrow strings (string/wstring/char[]/wchar[]/...) are a notable exception to this. They are dynamic arrays of UTF-8/UTF-16 code units. But they're not random-access ranges of Unicode code units. Instead, they're _forward_ ranges of

Re: How to use ranges?

2015-08-23 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 23 August 2015 at 17:58:44 UTC, Doolan wrote: ... Read this for a nice introduction: http://ddili.org/ders/d.en/ranges.html Then watch this: https://www.youtube.com/watch?v=A8Btr8TPJ8c

Re: How to use ranges?

2015-08-23 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 23 August 2015 at 17:58:44 UTC, Doolan wrote: ... Ali's book has a very nice chapter about ranges: http://ddili.org/ders/d.en/ranges.html

Re: How to use ranges?

2015-08-23 Thread anonymous via Digitalmars-d-learn
On Sunday 23 August 2015 19:58, Doolan wrote: >> You can use typeof to get the type of a range expression when >> typing it out is impractical/impossible. > What if I want to save a range in a struct? Or is a range more of > a verb than a noun..? Can still use typeof then: struct S { imp