在许多其他编程语言中,您可以将一个函数作为参数传递给另一个函数,并在函数内部调用它。在Netlogo中是否有这样的方法呢?例如以下内容:
这将是一个不错的特性。我正试图实现一种抽象的本地搜索算法,这将有助于传递目标函数等内容。
;; x,y,z are all ints
to-report f [x y z]
report x + y + z
end
;; some-function is a function
;; x y and z are ints
to-report g [some-function x y z]
report (some-function x y z) + 2
end
to go
show g f 1 2 3
end
这将是一个不错的特性。我正试图实现一种抽象的本地搜索算法,这将有助于传递目标函数等内容。