recursively substitute parameters until quiescence
allow add_wme to create a new id