I am not sure I understand your code nor what you want to accomplish, but heres
the same code returning string everywhere as you said:
import strutils, math, threadpool
{.experimental: "parallel".}
proc term(k: float): string =
var f = 4 * math.pow(-1, k) / (2*k + 1)
result = $f
proc pi(n: int): string =
var ch = newSeq[string](n+1)
parallel:
for k in 0..ch.high:
ch[k] = ^ spawn term(float(k))
result = ch.join
echo pi(5000)
Run
Just need to make the math make sense.
Flowvar is like a Promise on JavaScript or like a Future on Python, **but for
parallel.** Like a container type thingy, to put other thingies inside, as they
pop into existance at run time.