Nonparametric Representation of Policies and Value Functions: A Trajectory-Based Approach