|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
, [6 {! p _! I其中有一段如下
: Q; y1 i. O/ K" yask turtles with [ infected? = true ] * V6 ~) V6 T6 ~7 P/ o# ]
我原本以为这句会回传『所有』infected? = true 的 turtle# n: z5 p# w# {0 z
但看结果似乎不是这样。* G+ w) @4 m8 ?8 p$ l+ w& o
3 N5 \$ e* ^# U& F. M0 H
假设所有符合条件的有 5 笔
, C' a; k$ R! d0 S有时候回传 1 笔,有时回传 3 笔,是不固定的% E1 m, k4 U3 J$ S) ~
回头查语法定义: x$ C- o; m2 v) L' _
with
; y6 B7 n' c( @- r* @9 Wagentset with [reporter]# F# i+ D/ i1 }
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.
" g; a$ W, O4 T- |* r5 U- w3 ^- g) j它只说回传 agents satisfying the given condition
8 |( b$ {+ {3 q是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ' {4 C# C* [ ^+ J- X- ?2 h
# O8 { [- U0 ~5 a. a0 Z: G
想确定一下" S$ O1 x( |4 K7 I) B! Q
谢谢!8 ^+ ^/ O4 r+ Y1 p3 w* ]
|
|