lambda functions in R

There's a great Stack Overflow post about lambda functions, but it doesn't include an example of how to implement one in R! Help me change that by critiquing this reprex:

adder <- function(x) {
  function(y) x + y

add5 <- adder(5)
#> [1] 6

Created on 2019-08-21 by the reprex package (v0.3.0)

Do you think this is adequate minimal example of a lambda function in R?


Yes, it seems like a very similar example to ones that are there already.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.