Apparently your variable b
contains a turtle, not a list. Did you initialize b
to contain an empty list?
lput
won't create a list from nothing. It can only add an item to an existing list.
Here's some code showing that lput
works just fine for adding turtles to a list, as long as you have a list (perhaps empty) to begin with:
to test
crt 10
let b []
repeat 5 [
set b lput (one-of turtles) b
]
print b
end
when I run this in the Command Center, I see:
observer> test
[(turtle 3) (turtle 8) (turtle 8) (turtle 1) (turtle 3)]