Trouble with lockstep

Craig Dillabaugh cdillaba at cg.scs.carleton.ca
Mon Jun 24 08:51:01 PDT 2013


On Monday, 24 June 2013 at 15:29:21 UTC, Joseph Rushton Wakeling
wrote:
> On 06/24/2013 03:05 PM, Craig Dillabaugh wrote:
>> I get the following error messages which I cannot decipher.
>
> Oddly enough, I'm also getting lockstep-related error messages 
> at compile-time:
>
> /opt/gdc/include/d/4.8.1/std/range.d:4716: Error: delegate dg 
> (ref double, ref
> ulong) is not callable using argument types (double, ulong)
> test.d:122: Error: opApply() function for Lockstep!(Result, 
> ulong[]) must return
> an int
> /opt/gdc/include/d/4.8.1/std/range.d:4717: Error: delegate dg 
> (ulong, ref
> double, ref ulong) is not callable using argument types (ulong, 
> double, ulong)
>
> test.d:122 is a foreach over a lockstep:
>
>     foreach(r, x; itemDegree) ...
>
> where itemDegree is generated by the following function:
>
>     auto degreeRank(NodeT)(NodeT nodes)
>     {
>         size_t[] x;
>         foreach(node; nodes)
>             x ~= node.links.length;
>         x.sort;
>         auto r = iota(1.0, 0, -1.0/x.length);
>         return lockstep(r, x);
>     }
>
> By the way, yes, I know I can probably find a better and more 
> efficient way to
> generate x than what's there.  It's what I wrote some time ago 
> and never had a
> pressing enough need to improve. :-P

I think my original attempt compiled at home (where I was using
and older version 2.062), but I couldn't compile it at work with
the latest DMD (2.063).  I didn't mention it in the original post
because I couldn't recall for sure if I had successfully compiled
it.  You appear to be using GDC, but maybe this has something to
do with recent changes.


More information about the Digitalmars-d-learn mailing list