Q:

Difference between `is-agent?` and `is-turtle?`

I believe this must be an easy question, but I have not found the difference between is-agent? and is-turtle? primitives, and when I should use one instead of the other. 

A:

Turtles, patches, and links are all agents.  So is-agent? will return true for any of those.  But patches and links are obviously not turtles, so is-turtle? will return false for those.
breed [ ghouls ghoul ]

to test
  clear-all
  create-turtles 1
  create-ghouls 1
  ask turtle 0 [ create-link-to turtle 1 ]

  show is-agent? turtle 0   ; true
  show is-agent? ghoul 1    ; true
  show is-agent? patch 0 0  ; true
  show is-agent? link 0 1   ; true

  show is-turtle? turtle 0  ; true
  show is-turtle? ghoul 1   ; true
  show is-turtle? patch 0 0 ; false
  show is-turtle? link 0 1  ; false

  show is-ghoul? turtle 0   ; false
  show is-ghoul? turtle 1   ; true
end    

So if you're trying to differentiate agents from things like numbers, strings, and true/false values, you'd use is-agent?.  When you really, for-sure want to be dealing with turtles, use is-turtle?.  

