|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
$ W& y; {( h8 k' K其中有一段如下
. t. b2 a3 X% c, `3 Y: _ask turtles with [ infected? = true ]
; ]' z; _* C% t+ Q我原本以为这句会回传『所有』infected? = true 的 turtle
8 @, U. l% \: _* w0 D0 q6 P但看结果似乎不是这样。5 a6 v& X a/ e9 ]+ P" Q, c5 _
) y0 Z }2 v; }3 T. C
假设所有符合条件的有 5 笔2 Z- d1 \" g _9 x0 e, ]9 M
有时候回传 1 笔,有时回传 3 笔,是不固定的
: b+ [' d5 {* g! G4 C9 N回头查语法定义8 {2 C, j# C/ K; F/ K* n
with
2 m% N9 q& T2 U8 bagentset with [reporter]) ?$ x- Q }" L9 W" l
Takes 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.- ^; P2 n3 I0 o9 r4 d1 ?
它只说回传 agents satisfying the given condition( m! M, F& f# N; {
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? $ U8 ^) F9 H& L! |
- X7 Y2 M3 s! G- r! Y0 e$ c+ x想确定一下( ~# Q2 c; f& s* U1 K5 H& S2 ]! n
谢谢!
8 m) i9 {- n* v/ ~# N7 ?* K9 V. } |
|