charCodeAt is partly fixed.  substitute needs to remove all bound variables.