[Issue 4729] New: std.algorithm: atrange iota behaviour

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 26 05:16:48 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4729

           Summary: std.algorithm: atrange iota behaviour
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Optlink
        AssignedTo: nobody at puremagic.com
        ReportedBy: necroment at gmail.com


--- Comment #0 from Max Klyga <necroment at gmail.com> 2010-08-26 05:16:40 PDT ---
import std.stdio, std.algorithm, std.range;

void main() {
    filter!((int n) { write(n, ' '); return 0; })(iota(1, 10));
    //writes: 1 2 3 4 5 6 7 8 9

    writeln();

    reduce!"0"(
        filter!((int n) { write(n, ' '); return 1; })(iota(1, 10))
    ); //writes: 1 2 3 4 5 6 7 8 9

    writeln();

    reduce!"0"(
        filter!((int n) { write(n, ' '); return 0; })(iota(1, 10))
    ); //Never stops writing numbers
}

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


More information about the Digitalmars-d-bugs mailing list