Open jimrothstein opened 4 years ago
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:
named arguments
f(x = 5)
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)
square1 <- power1(exponent = 2)
Thanks for the nudge! I thought about doing this in my last update, and should have done so. Will fix in the next update!
This may be trivial to experienced users, but I found it useful to use
named arguments
in a function callf(x = 5)
at least initially when presenting the factory idea:In 2nd code block, under simplest function factories:
NOW
SUGGEST (at least first time)
square1 <- power1(exponent = 2)