|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序2 N; u# L' N* B5 d1 ^. _) S* K V
其中有一段如下
5 T1 s- `& b5 d9 l, _) l( N# pask turtles with [ infected? = true ] 2 T; E9 q4 ?2 _
我原本以为这句会回传『所有』infected? = true 的 turtle
' T9 J$ l$ d3 D3 q1 w+ M但看结果似乎不是这样。
& m$ e; F6 H2 y2 H
$ @0 l6 u( g s. H5 S7 |. E假设所有符合条件的有 5 笔
- o0 k/ }% D) w+ I% F! Z2 c9 w+ O; f有时候回传 1 笔,有时回传 3 笔,是不固定的& S* v6 x2 z M' ?# o2 y
回头查语法定义) @# J4 d$ D9 G5 Q i, h, v
with
) }% ]9 u4 e8 v6 K- r8 I! D) m0 jagentset with [reporter]
) ~3 j# Q9 ^7 fTakes 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.) z" E H! w& k* F2 D7 l* T1 P6 T; J
它只说回传 agents satisfying the given condition
5 R0 d$ `4 K9 u8 z; {7 O. o C是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? {& m0 E4 j" M1 s+ b2 c7 w
0 m! X; k; @& `* H# a
想确定一下
, a+ N ~. u, }2 i谢谢!4 g' i3 g2 e0 ? P
|
|