|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
4 J3 \/ ^6 Q5 q! @其中有一段如下
6 A5 L1 u" m' x* M4 `( b6 t1 Yask turtles with [ infected? = true ]
9 A" ? V4 Y& J) ]' R我原本以为这句会回传『所有』infected? = true 的 turtle
/ j0 W( E3 T6 n8 D: i2 ?但看结果似乎不是这样。) o0 A8 p/ T: Q
1 B3 C u2 Y" x; j& T/ F: m& l3 E假设所有符合条件的有 5 笔4 ?- S1 v+ \3 D) G" A) |6 X
有时候回传 1 笔,有时回传 3 笔,是不固定的+ o: ?) x- l# ~/ X9 @
回头查语法定义. ?+ K! _# K5 L! W
with
5 g3 z0 c2 {8 l0 Ragentset with [reporter]1 y$ y/ Y- W, \7 ]+ ]3 ?- o
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.
$ |+ ^( ?' {7 ^! G2 s它只说回传 agents satisfying the given condition r* }% `. o9 t' H; c# m+ b/ _
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
8 U4 x0 t+ O$ l
* q$ ^# W0 `% S7 ?3 j想确定一下: j) k$ b, @2 [1 ~
谢谢!5 f3 B, v) }. ?
|
|