www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4802] New: Incorrect Radial example

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4802

           Summary: Incorrect Radial example
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2010-09-03
08:50:34 PDT ---
From: http://www.digitalmars.com/d/2.0/phobos/std_range.html#Radial

int[] a = [ 1, 2, 3, 4, 5 ];
assert(equal(radial(a) == [ 3, 2, 4, 1, 5 ][]));
a = [ 1, 2, 3, 4 ];
assert(equal(radial(a) == [ 2, 3, 1, 4 ][]));

The equality Op shouldn't be there but the first array literal is wrong as
well. This should be:

int[] a = [ 1, 2, 3, 4, 5 ];
assert(equal(radial(a), [ 3, 4, 2, 5, 1 ]));
a = [ 1, 2, 3, 4 ];
assert(equal(radial(a), [ 2, 3, 1, 4 ]));

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 03 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4802



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2010-09-03
08:52:42 PDT ---
The docs also state:

Iterates a random-access range starting from a given point and progressively
extending left and right from that point. If no initial point is given,
iteration starts from the middle of the range. Iteration spans the entire
range. 

However it iterates Right first and then Left, not the other way around. So
maybe change the sentence to: "Iterates a random-access range starting from a
given point and progressively extending right and left from that point."

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 03 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4802


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dsimcha yahoo.com
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 03 2010