|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
" W( G% v9 W$ }; w$ C其中有一段如下# l6 [5 J7 F* h: V
ask turtles with [ infected? = true ]
! l9 ]# B* m* b6 s我原本以为这句会回传『所有』infected? = true 的 turtle
: a) w* Z' I+ |$ T; j, R; W. s/ J但看结果似乎不是这样。 z q* d( U' i# b% B3 ?3 s
# ~' l: U v' m) K: ^6 q/ {
假设所有符合条件的有 5 笔
3 R8 n+ r" X* B6 f: x/ L5 c有时候回传 1 笔,有时回传 3 笔,是不固定的
' f c$ c/ H |6 _$ }( i7 ~& f回头查语法定义
/ o* v9 B* I# `% owith 8 P( W( g5 X& q7 h# z: O
agentset with [reporter]
5 R- B4 _2 K$ bTakes 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.
; K3 H! ~6 l" ?它只说回传 agents satisfying the given condition" r: r' P2 a9 C! B: G
是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ?
; @( n$ A$ R1 A% @1 S* b, E* l/ I$ L: F& y4 Y
想确定一下( w. [' E5 a6 k# P% P, n& T
谢谢!. T" b4 u* J& w4 _' T6 W
|
|