Re: getting a list of distances from a given agent
It looks like you are going about it the wrong way, overall. But to
answer your question:
If you want to sort by distance, you have to use SORT-BY
Set L sort-by [ [distance myself ] of ?1 < [ distance myself ] of ?2 ] enforcers
However, then your last statement won't work, because min-n-of wants L
to be an agentset, not a list.
I think what you want is
Set L sort-by [ [distance myself ] of ?1 < [ distance myself ] of ?2 ]
( enforcers-on neighborhood )
On Sun, May 25, 2008 at 5:51 PM, someonetookstoafer
<[hidden email]> wrote:
> I know there have recently been some related posts on this issue, but
> I have been unable to solve my problem using those posts.
> I am interested in getting a list of the distances of all the turtles
> within a given neighborhood of the specified agent. I have tried the
> sort command to do this in the following manner:
> set L sort enforcers [distance myself]
> let N count (enforcers-on neighborhood)
> set D min-n-of N L
> but get the error:
> 'expected command in place of the [distance myself]'
> This seems like an easy problem to fix, but I have been having a lot
> of trouble with it. Sorry about the recurrent themes in postings.