from numba.six.moves import reduce as pyreduce

def Reduce(func):
    def reduce_wrapper(seq, init=None):
        # Numba's CUDA reduce allows an empty sequence to be reduced with no
        # initializer but functools.reduce does not.
        if len(seq) == 0 and init == None:
            init = 0
        if init is not None:
            return pyreduce(func, seq, init)
        else:
            return pyreduce(func, seq)
    return reduce_wrapper

reduce = Reduce

@@ -90,18 +90,25 @@
 seq,
+ res=None,
  init=
-None
+0
 ):%0A 
@@ -118,267 +118,112 @@
     
-# Numba's CUDA reduce allows an empty sequence to be reduced with no%0A        # initializer but functools.reduce does not.%0A        if len(seq) == 0 and init == None:%0A            init = 0%0A        if init is not None:%0A            return pyreduce(func, seq, init)
+r = pyreduce(func, seq, init)%0A        if res is not None:%0A            res%5B0%5D = r%0A            return None
 %0A   
@@ -256,27 +256,9 @@
 urn 
-pyreduce(func, seq)
+r
 %0A   

Update simulator for new reduction semantics