Upgrade to 6.0.2

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Upgrade to 6.0.2

mijujoel-2
I was looking at a model of Organizational Change using a "Garbage Can" model.   There is a foreach command that looks for certain conditions and adds or removes each member of the list based on these conditions.   However, the statement uses a "?" that presumably meant the current member of the list in earlier versions of Netlogo but no longer works:
 

 set encountered fput ? encountered
 

 What should be used in place of the "?" now?
 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Upgrade to 6.0.2

francois.guerrin
set ? -> encountered fput ? encountered
Reply | Threaded
Open this post in threaded view
|

Re: Upgrade to 6.0.2 [1 Attachment]

francois.guerrin
In reply to this post by mijujoel-2
Hi Mijujoel,

I tried to post an answer yesterday on the NetLogo users group website,
however my posts didn't appear yet so I guess there may have been a bug.

Anyway, below my answer to deal with your issue.

Here is a simple example looking like yours:

*    globals my-list
*

*    set my-list []; initiates an empty list
*

*    ask turtles [*

*      foreach [who] of turtles-here with [who > 100] [? -> set my-list
fput ? my-list ] ; of course you need to have more than 100 turtles!
*

*]*

*So in your case you should put :*

*    ...foreach [who] of turtles-here with…;; verify that this is a list *

*    [ ? ->   set encountered fput ? encountered ]*

*...
*

*You can still use the "?" in version 6.02 along with any letter or word
(foo or whatever) to stand for anonymous variables.*

*The tricky point is the "->" you must use to map your anonymous
variable (here each starting list element) to the procedure you want it
to follow (here adding the element to a list).*

*Explanations may be found in the transition guide or the release notes
for version 6.0x on the NL main site (click on download).*

*Hope this will help you.*

*Cheers*

*FG
*


Le 24/10/2017 à 05:41, [hidden email] [netlogo-users] a écrit :

>
> I was looking at a model of Organizational Change using a "Garbage
> Can" model.   There is a foreach command that looks for certain
> conditions and adds or removes each member of the list based on these
> conditions.   However, the statement uses a "?" that presumably meant
> the current member of the list in earlier versions of Netlogo but no
> longer works:
>
>
> set encountered fput ? encountered
>
>
> What should be used in place of the "?" now?
>
>
>
>
>

--

SignatureMail-FG.png (33K) Download Attachment