Functional programming nim中的传递函数

Functional programming nim中的传递函数,functional-programming,parameter-passing,nim-lang,Functional Programming,Parameter Passing,Nim Lang,我在Nim(版本0.10.2)中传递数学函数(PROC)时遇到问题 我得到了错误 Error: 'sqrt' cannot be passed to a procvar 如果我为sqrt编写一个包装器函数,它就可以正常工作 proc fxn(x: float): float = math.sqrt(x) var s2 = map(s1, fxn) 我使用平方根和map作为示例,但最终我将把sqrt(和其他数学过程)传递给另一个过程。有没有一种方法可以在不编写包装函数的情况下实现这一点?有计划

我在Nim(版本0.10.2)中传递数学函数(PROC)时遇到问题

我得到了错误

Error: 'sqrt' cannot be passed to a procvar
如果我为sqrt编写一个包装器函数,它就可以正常工作

proc fxn(x: float): float = math.sqrt(x)
var s2 = map(s1, fxn)

我使用平方根和map作为示例,但最终我将把sqrt(和其他数学过程)传递给另一个过程。有没有一种方法可以在不编写包装函数的情况下实现这一点?

有计划通过默认启用
procvar
pragma并为C导入的程序生成包装procvar来实现这一点:

proc fxn(x: float): float = math.sqrt(x)
var s2 = map(s1, fxn)