2
我想調試我的NetLogo代碼, 我想從鄰居的概率創建一個列表,然後使用'reduce'將列表中的所有這些值相乘。據我可以告訴這是工作,除非它運行它給運行時錯誤如下。使用減少在NetLogo中乘以一個列表
我也嘗試過使用'let P reduce [?1 *?2] prob-list',但它給出了相同的錯誤。
注意Prob_water_water_breaking,Prob_solute_solute_breaking被定義爲'globals',然後在設置時將它們分配給特定的品種。
to-report all-probabilities
let prob-list (list ([Prob_water_water_breaking ] of turtles-on neighbors4)
([Prob_solute_solute_breaking ] of turtles-on neighbors4)
let P reduce * prob-list ;;this is the line that's causing the error
report P
end
這是侏儒時錯誤:
* expected input to be a number but got the list [0.3 0.3 0.3] instead.
error while solute 2 running *
called by procedure ALL-PROBABILITIES
called by procedure GO
called by Button 'go'
任何幫助將是非常讚賞,非常感謝!
非常感謝Nicolas!這已經解決了問題!我非常感謝你的幫助! – 2014-11-22 00:52:21