Question:
I’m trying to parallelize this function by using @async @syncThreads.nthreads()
and they are 4Answer:
Your code is sequential, as you have a recursive dependence inres
– so trying to parallelize it is both not possible and can lead to incorrect results. Essentially your code tries to re-implement foldr
in a less efficient and non-generic way:If you have better answer, please add a comment about this, thank you!