I can define and use an anonymous function and call it like this

```
x <- 1:3
sapply(x, function(x) x)

```

Sometimes I feel that using `function` like this is too verbose. Is there another way to define an anonymous function?

In the [`purrr` package](https://purrr.tidyverse.org/), one can define an anonymous function like this

```
map(x, ~.x)

```

but this only works in the `purrr` context.