You need to provide an anonymous proc. This works:
import sugar
proc calc(a: int, b: int): (int) -> int =
let diff = a - b
result = proc (c: int): int =
result = c - diff
let diff_proc = calc(5, 6)
echo diff_proc(7)
Run
- Error: got proc, but expected proc {.closure.} readysloth
- Re: Error: got proc, but expected proc {.closure.} doofenstein
- Re: Error: got proc, but expected proc {.closure.} lscrd
