Is it possible to create a function that checks for non-Markovian state of an object in Scenic?

I wish to create a helper function which checks whether an object (e.g. car) is consecutively moving towards a particular target object (e.g. pedestrian) over N time steps.

Could you give an example of such code?