higher order builtins in js when simple recursions