Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. # Higher order function that returns a function:
  2.  
  3. make_sum = function () {
  4. # Some code here …
  5. message('Requesting to calculate a sum')
  6. sum
  7. }
  8.  
  9. seq(1, 10) %>% sum
  10. # Now, logically, what does this do?
  11. seq(1, 10) %>% make_sum()
  12. # Correct:
  13. seq(1, 10) %>% make_sum()()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement