jonthegeek / factory

factory: Build Function Factories
Other
49 stars 6 forks source link

Named arguments in calling function #36

Open jimrothstein opened 4 years ago

jimrothstein commented 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:

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)

jonthegeek commented 4 years ago

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