Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Higher order function that returns a function:
- make_sum = function () {
- # Some code here …
- message('Requesting to calculate a sum')
- sum
- }
- seq(1, 10) %>% sum
- # Now, logically, what does this do?
- seq(1, 10) %>% make_sum()
- # Correct:
- seq(1, 10) %>% make_sum()()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement