factory icon indicating copy to clipboard operation
factory copied to clipboard

Named arguments in calling function

Open jimrothstein opened this issue 5 years ago • 1 comments

This may be trivial to experienced users, but I found it useful to use named arguments in a function call f(x = 5) at least initially when presenting the factory idea:

In 2nd code block, under simplest function factories:

NOW

square1 <- power1(2)
square1(2)
#> [1] 4
# 2 ^ 2 = 4

SUGGEST (at least first time) square1 <- power1(exponent = 2)

jimrothstein avatar Jun 08 '20 21:06 jimrothstein

Thanks for the nudge! I thought about doing this in my last update, and should have done so. Will fix in the next update!

jonthegeek avatar Jun 08 '20 21:06 jonthegeek