core: Rewrite eval_apply in continuation passing style.