Advertisement
brandizzi

Lazy evaluation in R

Jul 23rd, 2014
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.24 KB | None | 0 0
  1. f <- function(a, b) {
  2.   print('1st value will be printed')
  3.   print(a)
  4. }
  5.  
  6. f(2, print('ok'))
  7. # Output:
  8. # [1] "1st value will be printed"
  9. # [1] 2
  10.  
  11. f(print('ok'), 2)
  12. # Output:
  13. # [1] "1st value will be printed"
  14. # [1] "ok"
  15. # [1] "ok"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement