if reelID = reelWeights.Count - 1
then Array.fold calc1 (0L,0) reelWeights.[reelID]
else Array.fold calc2 (0L,0) reelWeights.[reelID]
I tried use pipeline, it seems to slow down a little bit (not sure why):
reelWeights.[reelID]
|> (if reelID = reelWeights.Count - 1 then Array.fold calc1 else Array.fold calc2) (0L,0)
if I do
let calc x = if x then calc1 else calc2
Array.fold (calc reelID = reelWeights.Count - 1) (0L,0) reelWeights.[reelID]
then it looks nice at the cost of redundantly check conditionion in loops.
Assuming
calc1andcalc2have the same signature (or if they’re values rather than functions, are the same type):