List IFELSE[比较两个单独列表的长度][ACT]

List IFELSE[比较两个单独列表的长度][ACT],list,filter,netlogo,string-length,List,Filter,Netlogo,String Length,根据我的问题,我试图用filter和length实现代码。我想我实现了过滤器,但现在我需要代理将其列表长度与其他代理(活动)列表进行比较。这是我的密码: ask agentes [ set culture-tags n-values 17 [random 2] set shared-culture (filter [ i -> i = 0 ] culture-tags) ;count 0s and

根据我的问题,我试图用
filter
length
实现代码。我想我实现了
过滤器
,但现在我需要代理将其列表长度与其他代理(活动)列表进行比较。这是我的密码:

ask agentes [
  set culture-tags n-values 17 [random 2]
  set shared-culture (filter [ i -> i = 0 ] culture-tags)  ;count 0s and 
                                                            create shared-culture
]
end

to move-agentes
  ask agentes [
    let nearest-activity min-one-of (activities) [ distance myself ] 
    ifelse any? activities in-radius sight-radius with
      [ length t-shared-culture = length shared-culture ] ;as many 0s in t-shared-culture (specified later in the setup for activities) as in shared-culture
    [  face nearest-activity ]
    [ rt random 40 
      lt random 40
      fd 0.3
    ]
]
Netlogo打印下一个错误:
“活动176运行SHARED-CULTURE时,活动品种不拥有变量SHARED-CULTURE错误”

我想错误一定在这里:
[length t-shared-culture=length shared culture]
但我不知道如何让这两个列表相互作用

您的
海龟拥有[…]
活动拥有[…]
变量声明是什么样子的?似乎您的品种
活动
没有
共享文化
变量。如果您声明了这一点,那么您可以说类似于最近活动的
If shared culture=[shared culture][…
他们没有。我希望我可以让它在没有相同变量声明的情况下工作。但我认为我必须这样做。我已经实现了你的建议,它工作得很好。非常感谢!没问题!如果你只想声明一次变量,你可以将它设置为
海龟自己的
变量,然后所有海龟都可以当然,我也没想过。我太专注于这件事了,我再也不能直接思考了。再次感谢你。