The error messages keep saying the issue is a mismatch with FlowVar[T]. In 
Chapter 6 of **Nim in Action** here is what it says they are.

`FlowVar[T] can be thought of as a container similar to the Future[T] type, 
which you used in chapter 3. At first, the container has nothing inside it. 
When the spawned procedure is executed in a separate thread, it returns a value 
sometime in the future. When that happens, the returned value is put into the 
FlowVar container.`

Here is updated `segcount`
    
    
    proc segcount(row, Kn: int): uint =
      var cnt = 0'u
      for k in 0..<Kn: cnt += seg[row + k].uint
      result = cnt
    

So `segcount` is returning a `uint` value. This works perfectly well as below 
with no type mismatch.
    
    
      var cnt = 0'u
      for i in 0..<rescnt:
          cnt += segcount(i*KB, Kn)
      primecnt += cnt
    

But using `spawn` causes a type mismatch: `cnt += spawn segcount(i*KB, Kn)`

No matter what kind of container for `cnt` you use a type mismatch error 
appears.

Reply via email to