|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
+ j9 l) D) t7 h9 z其中有一段如下
+ p2 v+ V( H) V! g- Fask turtles with [ infected? = true ]
/ R2 W7 V$ R; w" A$ [9 U2 n g) I我原本以为这句会回传『所有』infected? = true 的 turtle
: U! I) Q! V0 h5 b. T$ g& Y7 E但看结果似乎不是这样。5 j% O: a5 A4 z9 O
7 J6 _+ s8 B7 n* I3 o/ E假设所有符合条件的有 5 笔+ U+ I3 l. \8 x) W! b
有时候回传 1 笔,有时回传 3 笔,是不固定的0 i( b7 F' k f" t' [
回头查语法定义
4 e+ r4 i& B3 qwith 8 V7 _4 I t0 Q% C7 ~. u p* K
agentset with [reporter]1 d( \0 H9 M+ C9 y: X) 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., ]& s, {' Q2 J0 U: G
它只说回传 agents satisfying the given condition
- P, N% g+ l9 t L0 _8 a是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? + W% f. {& w8 E4 C) t+ H* J
: o) W6 Y- G" l" c8 o
想确定一下3 |! R3 C6 B* j4 x, a
谢谢!. G; L! r* N. X$ U b H
|
|