|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序& [+ }' C! I) i/ L: l
其中有一段如下
4 r4 L/ S& j9 Y6 ^/ q( z2 Xask turtles with [ infected? = true ] * P" v9 C0 z4 q6 E
我原本以为这句会回传『所有』infected? = true 的 turtle' Q) t8 v' f/ O. j2 o9 m% B
但看结果似乎不是这样。 o4 \4 z+ o% N7 O2 G
2 O% [# X% F# Y0 o0 @( O假设所有符合条件的有 5 笔
: M! A& c$ b, A有时候回传 1 笔,有时回传 3 笔,是不固定的% ]* K- [( |, a% ?3 K
回头查语法定义
; W6 j. x( K! ^7 q1 V: }, m( _with
! [# M0 M1 k6 e$ uagentset with [reporter]
7 w9 O, \3 H$ {: a" K% @ jTakes two inputs: on the left, an agentset (usually "turtles" or "patches"). On the right, a boolean reporter. Reports a new agentset containing only those agents that reported true -- in other words, the agents satisfying the given condition.2 \1 n9 V! e4 k [/ G; m
它只说回传 agents satisfying the given condition F$ `" E1 h9 B: m
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? , ?7 h) B2 Z% |/ q% J
( \+ e5 m* G% G9 l: }. E3 [
想确定一下" j3 A* Y* u. F* A- E4 z
谢谢!
+ `; [5 P* E+ J) q |
|