Well FlowVarBase is the base class, type it properly and then you can get the
result back via `^`:
import strutils, math, threadpool
proc term(k: float): float = 4 * math.pow(-1, k) / (2*k + 1)
proc computePI(n: int): float =
var ch = newSeq[FlowVar[float]](n+1)
for k in 0..n:
ch[k] = spawn term(float(k))
for k in 0..n:
result += ^ch[k]
echo formatFloat(computePI(5000))
- spawn & sync woes marksummerfield
- Re: spawn & sync woes Araq
- Re: spawn & sync woes marksummerfield
- Re: spawn & sync woes Araq
