Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tighten chatty() example #1642

Merged
merged 1 commit into from
Mar 19, 2023
Merged

Tighten chatty() example #1642

merged 1 commit into from
Mar 19, 2023

Conversation

dkahle
Copy link
Contributor

@dkahle dkahle commented Nov 19, 2020

I may be missing a deeper point here, but it seems simpler for chatty() to use message() instead of cat() and call it before the processing begins?

I may be missing a deeper point here, but it seems simpler for `chatty()` to use `message()` instead of `cat()` and call it before the processing begins?
@hadley
Copy link
Owner

hadley commented Jan 8, 2021

Hmmm, that is weird. Is chatty() used later in the chapter?

@dkahle
Copy link
Contributor Author

dkahle commented Jan 14, 2021

No, grep's only showing three instances of chatty, two in that first code chunk, and one in the preceding paragraph:

~/Dropbox/dev/adv-r/adv-r(master*) » grep 'chatty' Function-operators.Rmd
In this chapter, you'll learn about function operators. A __function operator__ is a function that takes one (or more) functions as input and returns a function as output. The following code shows a simple function operator, `chatty()`. It wraps a function, making a new function that prints out its first argument. You might create a function like this because it gives you a window to see how functionals, like `map_int()`, work.
chatty <- function(f) {
purrr::map_dbl(s, chatty(f))

@hadley hadley merged commit 14bdb11 into hadley:master Mar 19, 2023
@hadley
Copy link
Owner

hadley commented Mar 19, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants