In section 2.4 (p. 46) of the book Artificial Intelligence: A modern approach (3rd edition), Russell and Norvig write

The job of AI is to design an agent program that implements the agent function — the mapping from percepts to actions.

After that, in section 2.4.1, they write

Notice the difference between the agent program, which takes the current percept as input, and the agent function, which takes the entire percept history.

Why does the agent program only take current percept? Isn't the agent program just an implementation of the agent function?

So, what is the difference between an agent function and an agent program (with respect to the percept sequence)?


It looks as if 'function' is being used here in the mathematical (or functional programming) sense of 'pure function', i.e. it is without state or side-effects. Hence the function cannot store previous percepts anywhere, so the entire historical percept sequence is considered to be passed to the function each time.

In contrast, the notion of 'program' appears to allow state/side-effects, so it is assumed that earlier percepts are memoized as needed (or that they otherwise updated the variables used within the program).

The 'function' notion is the conceptually cleaner one, in that the 'program' version can always be abstracted to the functional one. Which aspects of percept history happen to be cached by the 'program' version is merely an implementation detail.


Not the answer you're looking for? Browse other questions tagged or ask your own question.