在netlogo中连接单词

时间:2017-05-10 10:16:46

标签: foreach concatenation netlogo

NetLogo用户

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

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

这里是list2 :(单词“turtle”)

然后我想列出哪个[“龟0”“龟1”“龟4”龟8“]

我怎么可能做到这一点?

提前谢谢

1 个答案:

答案 0 :(得分:2)

请注意(单词" 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