问题
NetLogo users
I want to make a list which concatenates lists, for example
Here is list 1 : [ 0 1 4 6 8]
and here is list2 : (word "turtle")
then I'd like to make list which ["turtle 0" "turtle 1" "turtle 4" turtle 8"]
How could I possibily make this?
Thank you in advance
回答1:
Note that (word "turtle") is just "turtle", so I'm not quite sure what you want. But this should cover it.
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
来源:https://stackoverflow.com/questions/43889591/concatenate-words-in-netlogo