[Issue 4456] New: std.range Recurrence is horribly broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 13 17:28:40 PDT 2010


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

           Summary: std.range Recurrence is horribly broken
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: yebblies at gmail.com


--- Comment #0 from yebblies <yebblies at gmail.com> 2010-07-13 17:28:36 PDT ---
Recurrence gives incorrect values when the order of previous states is
important.

eg
recurrence!"a[n-1] + a[n-2]"(1,2) works, but
recurrence!"a[n-2]"(1,2) does not.

fix:

    void popFront()
    {
        _state[_n % stateSize] = binaryFun!(fun, "a", "n")(
-           cycle(_state, _n), _n + stateSize);
+           cycle(_state), _n + stateSize);
        ++_n;
    }

The old values array is being offset twice, remove the argument to cycle and it
works perfectly.

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