call slice generation recursively