skip to main content

On the design, implementation, and use of laziness in R

Published:10 October 2019Publication History
Skip Abstract Section

Abstract

The R programming language has been lazy for over twenty-five years. This paper presents a review of the design and implementation of call-by-need in R, and a data-driven study of how generations of programmers have put laziness to use in their code. We analyze 16,707 packages and observe the creation of 270.9 B promises. Our data suggests that there is little supporting evidence to assert that programmers use laziness to avoid unnecessary computation or to operate over infinite data structures. For the most part R code appears to have been written without reliance on, and in many cases even knowledge of, delayed argument evaluation. The only significant exception is a small number of packages which leverage call-by-need for meta-programming.

Skip Supplemental Material Section

Supplemental Material

a153-goel

Presentation at OOPSLA '19

References

  1. Lennart Augustsson. 1993. The Interactive Lazy ML System. J. Funct. Program. 3, 1. Google ScholarGoogle ScholarCross RefCross Ref
  2. John W. Backus and al. 1963. Revised Report on the Algorithm Language ALGOL 60. Commun. ACM 6, 1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Richard A. Becker, John M. Chambers, and Allan R. Wilks. 1988. The New S Language. Chapman & Hall.Google ScholarGoogle Scholar
  4. Martin Bodin, Tomás Diaz, and Éric Tanter. 2018. A trustworthy mechanized formalization of R. In Symposium on Dynamic Languages (DLS). Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Olivier Flückiger, Guido Chari, Jan Ječmen, Ming-Ho Yee, Jakob Hain, and Jan Vitek. 2019. R Melts Brains: An IR for First-Class Environments and Lazy Effectful Arguments. In Dynamic Language Symposium (DLS). Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Robert Gentleman, Vince J. Carey, and al. 2004. Bioconductor: open software development for computational biology and bioinformatics. Genome Biology 5. Google ScholarGoogle ScholarCross RefCross Ref
  7. Paul Hudak. 1989. Conception, Evolution, and Application of Functional Programming Languages. ACM Comput. Surv. 21, 3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Paul Hudak, John Hughes, Simon L. Peyton Jones, and Philip Wadler. 2007. A history of Haskell: being lazy with class. In History of Programming Languages Conference (HOPL-III). Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. John Hughes. 1989. Why Functional Programming Matters. Comput. J. 32, 2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Ross Ihaka and Robert Gentleman. 1996. R: A Language for Data Analysis and Graphics. Journal of Computational and Graphical Statistics 5, 3. http://www.amstat.org/publications/jcgs/Google ScholarGoogle Scholar
  11. Tomas Kalibera, Petr Maj, Floreal Morandat, and Jan Vitek. 2014. A Fast Abstract Syntax Tree Interpreter for R. In Conference on Virtual Execution Environments (VEE). Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Filip Křikava and Jan Vitek. 2018. Tests from traces: automated unit test extraction for R. In International Symposium on Software Testing and Analysis (ISSTA). Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Uwe Ligges. 2017. 20 Years of CRAN (Video on Channel9). In UseR! Conference.Google ScholarGoogle Scholar
  14. Floréal Morandat, Brandon Hill, Leo Osvald, and Jan Vitek. 2012. Evaluating the Design of the R Language: Objects and Functions for Data Analysis. In European Conference on Object-Oriented Programming (ECOOP). Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Hannes Mühleisen, Alexander Bertram, and Maarten-Jan Kallen. 2018. Database-Inspired Optimizations for Statistical Analysis. Journal of Statistical Software 87, 4. Google ScholarGoogle ScholarCross RefCross Ref
  16. Chris Okasaki. 1995. Simple and efficient purely functional queues and deques. Journal of Functional Programming 5, 4. Google ScholarGoogle ScholarCross RefCross Ref
  17. Shawn T. O’Neil. 2015. Implementing Persistent O(1) Stacks and Queues in R. The R Journal 7. Issue 1. Google ScholarGoogle ScholarCross RefCross Ref
  18. Kent M. Pitman. 1980. Special Forms in LISP. In LISP Conference. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. David Smith. 2011. The R Ecosystem. In The R User Conference 2011.Google ScholarGoogle Scholar
  20. Luke Tierney. 2019. A Byte Code Compiler for R. www.stat.uiowa.edu/~luke/R/compiler/compiler.pdfGoogle ScholarGoogle Scholar
  21. David A. Turner. 1979. A New Implementation Technique for Applicative Languages. Softw., Pract. Exper. 9, 1. Google ScholarGoogle ScholarCross RefCross Ref
  22. David A. Turner. 1985. Miranda: A Non-Strict Functional language with Polymorphic Types. In Functional Programming Languages and Computer Architecture (FPCA). Google ScholarGoogle ScholarCross RefCross Ref
  23. Mitchell Wand. 1998. The Theory of Fexprs is Trivial. Lisp and Symbolic Computation 10, 3. Google ScholarGoogle ScholarCross RefCross Ref
  24. Hadley Wickham. 2016. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag. http://ggplot2.orgGoogle ScholarGoogle ScholarDigital LibraryDigital Library
  25. Hadley Wickham. 2017. tidyverse: Easily Install and Load the ’Tidyverse’. https://CRAN.R-project.org/package=tidyverseGoogle ScholarGoogle Scholar
  26. Hadley Wickham, Romain Francois, Lionel Henry, and Kirill Müller. 2018. dplyr: A Grammar of Data Manipulation. https://CRAN.R-project.org/package=dplyrGoogle ScholarGoogle Scholar
  27. Andrew K. Wright and Matthias Felleisen. 1992. A Syntactic Approach to Type Soundness. Information and Computation 115. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. On the design, implementation, and use of laziness in R

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in

          Full Access

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader
          About Cookies On This Site

          We use cookies to ensure that we give you the best experience on our website.

          Learn more

          Got it!