Skip to content


Suspicious line in Reduction.hs #71

rrnewton opened this Issue · 1 comment

2 participants


Is this correct? If so, it seems kind of non-idiomatic ;-). Can it be refactored?

for ( ix += gridSize; ix < shapeSize; ix += gridSize )


This is correct, although I guess a bit strange...

In the line above we need to initialise the local accumulator y = arr[ix] and then inside the loop we're reading in new values into x = arr[ix] before combining into y, so clearly ix needs to be incremented first. I guess the difficulty is that in the first pass we read array elements into y (to ensure it is initialised) but subsequently read into x. It's a one character change so perhaps comments would help to draw attention to what's going on.

@tmcdonell tmcdonell closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.