in the end i didn't use reduce. python sucks for FP i think