|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序0 ]: V/ b u R* e- u
其中有一段如下
) Z5 n: a# \$ Z1 r& \ask turtles with [ infected? = true ]
: B- F3 Q! k7 S0 C. v# a& @我原本以为这句会回传『所有』infected? = true 的 turtle
$ i1 }1 J( _1 ^! N% ^7 Y, c但看结果似乎不是这样。
+ ~2 B7 v9 a3 T1 g. U, X1 f
+ G2 J4 @+ k6 L" g/ F& P% m假设所有符合条件的有 5 笔
' B1 J' R, O7 j* H% Q8 w1 s* E有时候回传 1 笔,有时回传 3 笔,是不固定的
0 [5 b5 E" u: m# I$ l/ C回头查语法定义) G- k& B0 R* `
with . f& }. `5 m4 w8 L/ d6 U O+ c
agentset with [reporter]
' E2 v2 B0 z# X3 \' P4 ZTakes 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.' o3 R$ ]. L# f2 m$ M
它只说回传 agents satisfying the given condition
2 M3 O! t( B. W" n7 p$ L1 I# e是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
% V1 r: }6 @8 }1 g: s" {$ t7 K6 A' c
想确定一下; w. T. Y- K% t. a
谢谢!6 Y) P% ~. e& Q3 i" h
|
|