www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4800] New: Incorrect retro example

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

           Summary: Incorrect retro 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:36:15 PDT ---
From http://www.digitalmars.com/d/2.0/phobos/std_range.html#Retro

Full example:

import std.range;
import std.algorithm;

void main()
{
    int[] a = [ 1, 2, 3, 4, 5 ];
    assert(equal(retro(a) == [ 5, 4, 3, 2, 1 ][]));
}


The assert should be:

assert(equal(retro(a), [ 5, 4, 3, 2, 1 ][]));

-- 
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=4800



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2010-09-03
08:37:13 PDT ---
One other thing, what is the purpose of the extra square brackets next to the
array literal?

This compiles fine as well:

assert(equal(retro(a), [ 5, 4, 3, 2, 1 ]));

-- 
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=4800


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