|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
( M2 {" F8 H! G9 J% F其中有一段如下
) N6 c; [! x" y: _' @. Gask turtles with [ infected? = true ]
% n) E4 Z1 N% r. O, }, T我原本以为这句会回传『所有』infected? = true 的 turtle
6 e3 B+ E$ ]/ G, \- s" V+ g- ^% u7 v但看结果似乎不是这样。' {- O" n/ R) L3 [8 n1 Q: n& \
; \* I4 @" T8 B9 _9 o
假设所有符合条件的有 5 笔. w$ m2 q! A4 W
有时候回传 1 笔,有时回传 3 笔,是不固定的6 ]8 \4 r/ g" c: S9 E/ a% |( n
回头查语法定义
: F0 g$ g9 F$ y! s( z6 Ywith
7 S2 H6 o) ~5 f. y' e/ [agentset with [reporter]
! [% A i7 m9 s$ v H; HTakes 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.. r6 |6 T U& M. k! S; C9 Q
它只说回传 agents satisfying the given condition
- ?$ ~4 F# w+ a是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
) c" c2 h& e# e) _) `/ |8 b/ r2 l# a+ { t, \- }0 Q) h
想确定一下8 }* r- W) S" Y& m! N* H
谢谢!: ]4 `* G7 ^ [6 M# T6 w
|
|