Adverbs are never necessary. Hadley says they're mostly useful in functionals. We say that they permit a modular approach of function features, and that the tag approach can make it more intuitive and readable.
But when is it NOT a good idea do define an adverb ? A bad adverb is :
An adverb that is really just post processing, unless there's a really good reason not to just use function composition (purrr::compose and magrittr pipes might help).
An adverb that would contain a feature that we might want to apply to a non function object. If you end up needing: your_tag$identity(x), it was probably not a well designed tag.
An adverb that changes the behavior so much that the similarity of behavior with the original function would not be obvious.
An adverb that does several unrelated things, better have several adverbs.
An adverb that modifies the output structure significantly
An adverb that can be used on very few functions (though these might have a special place in dialects), we might as well build a wrapper around the original function, better than building an adverb.
An adverb that cannot be described easily, applying a function on a function is not an obvious thing, and adverbs being never necessary, they should not create friction
Adverbs are never necessary. Hadley says they're mostly useful in functionals. We say that they permit a modular approach of function features, and that the tag approach can make it more intuitive and readable.
But when is it NOT a good idea do define an adverb ? A bad adverb is :
An adverb that is really just post processing, unless there's a really good reason not to just use function composition (
purrr::compose
and magrittr pipes might help).your_tag$identity(x)
, it was probably not a well designed tag.An adverb that changes the behavior so much that the similarity of behavior with the original function would not be obvious.
An adverb that does several unrelated things, better have several adverbs.
An adverb that modifies the output structure significantly
An adverb that can be used on very few functions (though these might have a special place in dialects), we might as well build a wrapper around the original function, better than building an adverb.
An adverb that cannot be described easily, applying a function on a function is not an obvious thing, and adverbs being never necessary, they should not create friction