|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序+ j6 j, x. O% G1 h% C! e; t
其中有一段如下
2 b' s) X: w$ F9 z7 Z2 Uask turtles with [ infected? = true ] % r' _7 s, P# x
我原本以为这句会回传『所有』infected? = true 的 turtle
6 y6 X8 U( g A- ^) _. `; ?但看结果似乎不是这样。
# a/ X3 M" l# z6 O% T8 {* H8 }8 j5 h5 f1 [' b
假设所有符合条件的有 5 笔
( _2 s' k+ Z5 s2 X/ U有时候回传 1 笔,有时回传 3 笔,是不固定的
! V' u4 w* o0 Z- l. w. l& D回头查语法定义
% d. z+ d' J7 `. ^3 \3 v* I" ]with 4 r$ }8 m' A: T
agentset with [reporter]
. b- ~ d/ `' w0 B9 j% X& x. V7 \6 OTakes 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.& m1 n8 a* y( O h1 S3 z
它只说回传 agents satisfying the given condition
: J" N% v- h1 f$ q: x5 n Z8 T是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? % i' N$ w0 G) {" o& O p1 H
7 Q% r3 M" J. y2 f# m2 y
想确定一下
' ^* ^$ y. n* V6 C谢谢!
% A' ]" ^7 y2 I7 u, \ |
|