Re: Check whether a range is empty

2018-07-17 Thread Alex via Digitalmars-d-learn
On Tuesday, 17 July 2018 at 13:59:45 UTC, Gary Willoughby wrote: I thought every range at the lowest level has an `empty` property. So, in this case, it would be: if (PFResutl.toRange.empty) { writeln("Empty"); } Yeah, but it seems, that PFResutl is a range of ranges, and the OP has the

Re: Check whether a range is empty

2018-07-17 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 13 July 2018 at 18:37:35 UTC, vino.B wrote: Hi All, How do i check whether a range is empty. eg. (!PFResutl.toRange).empty. I tired the below, but it is no printing Empty if the range is empty it just prints blank line. if (!(!PFResutl.toRange).empty) { writeln("

Re: Check whether a range is empty

2018-07-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/15/18 8:56 AM, vino.B wrote: On Sunday, 15 July 2018 at 12:18:27 UTC, Steven Schveighoffer wrote: On 7/15/18 7:45 AM, vino.B wrote: [...] I still don't know why you are using chain here as it equates to the identity function in this instance: https://github.com/dlang/phobos/blob/3d41721

Re: Check whether a range is empty

2018-07-15 Thread vino.B via Digitalmars-d-learn
On Sunday, 15 July 2018 at 12:18:27 UTC, Steven Schveighoffer wrote: On 7/15/18 7:45 AM, vino.B wrote: [...] I still don't know why you are using chain here as it equates to the identity function in this instance: https://github.com/dlang/phobos/blob/3d41721141f31059ca6e77dec2da390fad737955/

Re: Check whether a range is empty

2018-07-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/15/18 7:45 AM, vino.B wrote: On Saturday, 14 July 2018 at 17:20:52 UTC, Ali Çehreli wrote: First, please show us code that demonstrates the issue. On 07/14/2018 07:47 AM, vino.B wrote: >    The reason it never prints the text "Empty" is that the out of the > "r" is just an empty array. >

Re: Check whether a range is empty

2018-07-15 Thread vino.B via Digitalmars-d-learn
On Saturday, 14 July 2018 at 17:20:52 UTC, Ali Çehreli wrote: First, please show us code that demonstrates the issue. On 07/14/2018 07:47 AM, vino.B wrote: >The reason it never prints the text "Empty" is that the out of the > "r" is just an empty array. > > OUTPUT: > [] > [] If that's the

Re: Check whether a range is empty

2018-07-14 Thread Ali Çehreli via Digitalmars-d-learn
First, please show us code that demonstrates the issue. On 07/14/2018 07:47 AM, vino.B wrote: >The reason it never prints the text "Empty" is that the out of the > "r" is just an empty array. > > OUTPUT: > [] > [] If that's the output of r, then r is not empty but has two elements and thos

Re: Check whether a range is empty

2018-07-14 Thread vino.B via Digitalmars-d-learn
On Saturday, 14 July 2018 at 14:28:52 UTC, vino.B wrote: On Friday, 13 July 2018 at 19:45:03 UTC, Steven Schveighoffer wrote: On 7/13/18 3:29 PM, vino.B wrote: [...] Well, empty is how you detect whether any range is empty, and as far as ranges are concerned, your code is correctly checki

Re: Check whether a range is empty

2018-07-14 Thread vino.B via Digitalmars-d-learn
On Friday, 13 July 2018 at 19:45:03 UTC, Steven Schveighoffer wrote: On 7/13/18 3:29 PM, vino.B wrote: [...] Well, empty is how you detect whether any range is empty, and as far as ranges are concerned, your code is correctly checking for empty. A couple comments: 1. Why are you using c

Re: Check whether a range is empty

2018-07-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/13/18 3:29 PM, vino.B wrote: On Friday, 13 July 2018 at 19:05:20 UTC, Steven Schveighoffer wrote: On 7/13/18 2:37 PM, vino.B wrote: Hi All,    How do i check whether a range is empty. eg. (!PFResutl.toRange).empty. I tired the below, but it is no printing Empty if the range is empty it

Re: Check whether a range is empty

2018-07-13 Thread vino.B via Digitalmars-d-learn
On Friday, 13 July 2018 at 19:05:20 UTC, Steven Schveighoffer wrote: On 7/13/18 2:37 PM, vino.B wrote: Hi All,   How do i check whether a range is empty. eg. (!PFResutl.toRange).empty. I tired the below, but it is no printing Empty if the range is empty it just prints blank line. if

Re: Check whether a range is empty

2018-07-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/13/18 2:37 PM, vino.B wrote: Hi All,   How do i check whether a range is empty. eg. (!PFResutl.toRange).empty. I tired the below, but it is no printing Empty if the range is empty it just prints blank line. if (!(!PFResutl.toRange).empty) { writeln("Empty"); } Without kn

Check whether a range is empty

2018-07-13 Thread vino.B via Digitalmars-d-learn
Hi All, How do i check whether a range is empty. eg. (!PFResutl.toRange).empty. I tired the below, but it is no printing Empty if the range is empty it just prints blank line. if (!(!PFResutl.toRange).empty) { writeln("Empty"); } From, Vino.B