Skip to content

Instantly share code, notes, and snippets.

@ColinFay
Created April 4, 2018 07:37
Show Gist options
  • Save ColinFay/d32cf4c9c5fb8d849f12a4e98d6c0549 to your computer and use it in GitHub Desktop.
Save ColinFay/d32cf4c9c5fb8d849f12a4e98d6c0549 to your computer and use it in GitHub Desktop.
# Make a function sleep
sleepy <- function(fun, sleep){
function(...){
Sys.sleep(sleep)
fun(...)
}
}
sleep_print <- sleepy(print, 2)
Sys.time()
sleep_print("pouet")
Sys.time()
purrr::walk(1:5, ~ sleep_print(Sys.time()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment