他の多くのプログラミング言語では、関数を引数として別の関数に渡して、関数内から呼び出すことができます。関数をNetlogoのパラメータとして渡す
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
これは便利な機能だろう。私は、これが客観的な関数などを渡すためにいいと思う抽象的なローカル検索アルゴリズムを実装しようとしています。
はい。タスクの詳細については、http://ccl.northwestern.edu/netlogo/docs/programming.html#tasksを参照してください。 –