convert textual inventory tasks into functions

Functions for performing what I expect will be the usual
operations on the inventory.