|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序7 F* c/ K3 j9 g% s% a9 b
其中有一段如下
) |7 R: P8 L# `9 R* bask turtles with [ infected? = true ]
' z, b r) x4 h( `* X我原本以为这句会回传『所有』infected? = true 的 turtle# I B/ S0 {- z4 i) K1 |% h e+ d
但看结果似乎不是这样。/ {* E0 F: B* N
, N# h( X! n8 c
假设所有符合条件的有 5 笔, C( P+ o" ?& r& _
有时候回传 1 笔,有时回传 3 笔,是不固定的
( g# v" I( N8 x! u回头查语法定义) z( z% N* X3 h2 T6 t- g+ V
with
* ^ O ]. ?; L: ^5 l& vagentset with [reporter]8 V2 m [/ b5 L" o/ I# `
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.1 B& }: E7 d: K& d3 b4 b( F6 H7 k
它只说回传 agents satisfying the given condition& }( Q2 F5 |' L+ h) B
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
' H/ C( B7 X* R
1 U7 B# \2 B. E1 {/ I想确定一下5 x/ U% ~6 {7 g: e9 K/ _8 t- g: e
谢谢!$ C4 S; b, ]+ w. R- j7 Y! s8 D3 ?8 G
|
|