Prims - Implement agent variables, Implement of, who
[clnl] / src / main / nvm / agent.lisp
1 (in-package #:clnl-nvm)
2
3 (defun agent-value (var &optional (agent *self*))
4  "AGENT-VALUE VAR &optional AGENT => RESULT
5
6 ARGUMENTS AND VALUES:
7
8   VAR: A variable name
9   AGENT: an agent, defaulting to *self*
10   RESULT: the value of VAR
11
12 DESCRIPTION:
13
14   AGENT-VALUE is the general agent variable access function.  For many
15   NetLogo reporters, the compilation results is AGENT-VALUE.  The list of
16   valid values are any builtin variable in the NetLogo dictionary, as well
17   as any *-own variable.
18
19   See http://ccl.northwestern.edu/netlogo/docs/dictionary.html for builtins"
20  (agent-value-inner agent (intern (string-upcase var) :keyword)))
21
22 (defgeneric agent-value-inner (agent var))
23
24 (defmethod agent-value-inner ((agent turtle) (var (eql :who))) (turtle-who agent))