|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序) `$ A1 x8 ?( I8 M9 u7 A1 L9 s' `7 |
其中有一段如下
/ l* n3 ~! y9 c, } M! Jask turtles with [ infected? = true ] , s; c, i+ g/ h) f/ {
我原本以为这句会回传『所有』infected? = true 的 turtle
t0 g8 B% L0 i& u但看结果似乎不是这样。
, f: I8 ~) ?1 J b( f
7 K0 @; X2 F* |( K2 T: l" I6 K a假设所有符合条件的有 5 笔
; N9 @- }% ]$ O F5 T有时候回传 1 笔,有时回传 3 笔,是不固定的
- i+ A% y* U: ?* J O: [. D回头查语法定义
7 l# W, j2 ]$ Y: h5 S1 hwith & p7 S; R! E4 ]- S$ ]% X+ O
agentset with [reporter]
! v( P& B* u- D! v; F- `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.- U, O% d3 C7 _. F8 @$ s
它只说回传 agents satisfying the given condition
, _2 s! J; ~" x# O9 F+ a是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
3 H( q* W! ~% C1 s: I7 D h: i# c' \8 l% m
想确定一下
1 Y( ^* J" k/ h2 V9 R; [, ]1 s谢谢!1 I$ Z% S5 a- J( h, n
|
|