|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
O) T$ F/ I! [/ i- i/ ]其中有一段如下
# w; P& G; h Pask turtles with [ infected? = true ] ) ^ i" J! G0 s
我原本以为这句会回传『所有』infected? = true 的 turtle
. Z9 S1 k( l$ z# `6 U但看结果似乎不是这样。: n5 `: v# i- |
( k+ f( e# q5 B+ W. x假设所有符合条件的有 5 笔
1 `( |9 @% l0 l有时候回传 1 笔,有时回传 3 笔,是不固定的
5 A" r/ L2 R. B b. S. r回头查语法定义2 x) d `3 V+ g1 r$ S C
with
' [5 u' x& J6 ~ o8 z! magentset with [reporter]
, J/ V/ z. u y& V9 Q9 VTakes 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.- o# \% z# x9 u0 k2 ^
它只说回传 agents satisfying the given condition
; O% B: x2 E0 V' h) F s是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? ( X6 l7 J- B9 G& z3 B" c, y. j
% L8 f1 W- c9 \) M% e* A0 I想确定一下0 Q S7 y/ G |- J' Q2 a* d4 n
谢谢!
+ o) ^: V5 c6 Z; X |
|