Thread overview
[Issue 4456] New: std.range Recurrence is horribly broken
Jul 14, 2010
yebblies
July 14, 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@puremagic.com
        ReportedBy: yebblies@gmail.com


--- Comment #0 from yebblies <yebblies@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: -------
July 14, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4456


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 14, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4456


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


--- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com> 2010-07-13 18:17:32 PDT ---
http://www.dsource.org/projects/phobos/changeset/1755

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