|
|
新手发问超简单问题,目前还处于研读范例码的阶段,边测边看结果来理解程序
, Y J$ d+ D2 ]0 x7 c$ L2 |# m其中有一段如下
6 G+ f- Y7 h6 w H: E% [. cask turtles with [ infected? = true ]
$ g; B, S) ?9 \: @: w+ i8 O我原本以为这句会回传『所有』infected? = true 的 turtle
; ^, t: p- V0 v) @5 l但看结果似乎不是这样。
# _1 `3 t, [0 H) t) @+ R5 n( k: q! z8 F" n+ N% {( d0 K5 f
假设所有符合条件的有 5 笔
- C y9 ^6 N- j7 p$ D4 x有时候回传 1 笔,有时回传 3 笔,是不固定的
% R* k5 Q! K- l1 [回头查语法定义
) X/ W# r4 I" ]- ?9 H% hwith
; m, b- {; z. O( s$ g; G0 s Cagentset with [reporter]
3 H6 L, C! V# t1 w. |: }* uTakes 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.
l1 ^3 j( q6 Y9 n2 y它只说回传 agents satisfying the given condition
% t' A) c3 z+ P* M1 \是否 with 回传的是『符合条件』的数据,而不是『所有符合条件』的数据 ? I+ n) h U) i, p* g( X
2 u, @# t! o6 s0 h
想确定一下- _3 l x4 ^) R( Y/ U. _0 x
谢谢!- r o) z% R$ d
|
|