在 netlogo 中连接单词

concatenate words in netlogo

NetLogo 用户

我想制作一个连接列表的列表,例如

这是清单 1:[0 1 4 6 8]

这里是 list2 : (word "turtle")

然后我想列出 ["turtle 0" "turtle 1" "turtle 4" 乌龟 8"]

我怎么可能做这个?

提前致谢

请注意,(单词 "turtle")只是 "turtle",所以我不太确定您想要什么。但这应该涵盖它。

to-report append-word [w xs]
  report map [[x] -> (word w " " x)] xs
end

to-report append-words [ws xs]
  report map [[w] -> append-word w xs] ws
end

to test
  let ws ["turtle" "rabbit"]
  let xs [0 1 4 8]
  print append-word item 0 ws xs
  print append-words ws xs
end