use code generation macro in vmap and vreduce