|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
: ~& j f3 ~ X' s其中有一段如下
9 N: I; Y5 F0 b$ l5 [: o. Cask turtles with [ infected? = true ]
8 u5 V k( @( i6 v/ z我原本以为这句会回传『所有』infected? = true 的 turtle" g) d9 [( b% ~$ U
但看结果似乎不是这样。& c6 g; l9 @9 a
- Q& N" W2 x( L, [4 k( O
假设所有符合条件的有 5 笔
9 T; a* {" n' T; n+ q5 D7 x8 B/ r5 l有时候回传 1 笔,有时回传 3 笔,是不固定的
' n; q! }# O& h回头查语法定义" K* s" I. x, R# L( w
with 4 y. \0 D3 |4 g3 R! P( H4 k4 Y
agentset with [reporter]
8 G4 P6 j, V1 N. g! x6 f wTakes 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.
$ v3 H, ]% |& X: a它只说回传 agents satisfying the given condition" S+ e' |' D: N3 T; B
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? 3 }& G! z4 J b' d9 ]2 L/ S z
- C+ ~ F) W2 a1 }9 J8 S
想确定一下
0 D3 d! h2 D- R; `/ C6 p3 q- ^4 N谢谢!
; e8 E4 x- C6 I3 p7 [! u |
|