The proc you want to return shouldn't have a name. So this line:
result = proc differentiate(c: int): int =
Run
should be
result = proc (c: int): int =
Run
The proc you want to return shouldn't have a name. So this line:
result = proc differentiate(c: int): int =
Run
should be
result = proc (c: int): int =
Run