should chain be pure

Daniel Davidson nospam at spam.com
Tue Oct 15 06:37:00 PDT 2013


I would like to correctly annotate my functions with pure. I've 
hit a function that is calling chain which breaks purity. Is 
chain really not pure?

The relevant section of code is:

       ...
       auto sortedRage = assumeSorted!("a.when < 
b.when")(opSlice());
       auto trisection = sortedRage.trisect(needle);
       auto ccRate = Rate(0.0);

       if(trisection[0].length) {
         ccRate = trisection[0][$-1].value;
       }
       foreach(dateRate; chain(trisection[1], trisection[2])) {
       ...

Is there a reasonable work around?

Thanks
Dan


More information about the Digitalmars-d-learn mailing list