Your code does not work because you are using `func` as identifier, which is a 
reserved keyword. I demangled it a bit and renamed `func` to `fun`:
    
    
    type
      MyProc1 = proc()
      MyProc2 = proc(p: MyProc1)
      MyProc3 = proc(p: MyProc1): MyProc1
    
    proc applyAllSync(funcs: seq[MyProc2], onAllDone: MyProc1) =
      fold(funcs,
           proc(onDoneNothing: MyProc1) = onDoneNothing,
           proc(doBefore: MyProc3, fun: MyProc2) =
             return (proc(onDone: MyProc1): MyProc1 =
                return doBefore(proc() =
                  fun(onDone)
                )
             )(onAllDone)()
      )
    

Reply via email to