面向对象编程、函数式编程和R
Object-Oriented Programming, Functional Programming and R
摘要:
本文回顾了R中的一些编程技术,这些技术已被证明是有用的,特别是对于大型项目。这些包括面向对象编程的几个版本,用于大量的R包。评论试图澄清各种版本背后的起源和思想,每个版本在适当的背景下都是有价值的。R也受到函数式编程思想的强烈影响,特别是将函数式编程与面向对象编程相结合的愿望。为了阐明这种特殊的思想组合是如何在当前的R语言和支持软件中产生的,本文将首先回顾面向对象和函数式编程背后的基本思想,然后研究R的演变,这些思想提供了背景。函数式编程支持定义良好的、可防御的软件,并提供可重现的结果。面向对象的编程是一种卓越的机制,可以在管理复杂性的同时为用户保持简单。这两种范式在支持主要软件以将模型拟合到数据和许多其他统计应用方面很有价值。这些范式在R.函数式编程激发了R语言的很多东西,但R语言并没有强制执行这种范式。从函数的角度来看,面向对象编程不同于非函数语言中使用的面向对象编程,需要强调这一区别以避免混淆。R最初复制了贝尔实验室的S语言,而S语言又受到早期程序库的强烈影响。在每一个阶段,新的想法都被添加进来,但以前的软件也继续在设计中显示其影响力。概述这一演变将进一步阐明为什么我们目前有这种有点不寻常的想法组合。
英文摘要:
This paper reviews some programming techniques in R that have proved useful, particularly for substantial projects. These include several versions of object-oriented programming, used in a large number of R packages. The review tries to clarify the origins and ideas behind the various versions, each of which is valuable in the appropriate context. R has also been strongly influenced by the ideas of functional programming and, in particular, by the desire to combine functional with object oriented programming. To clarify how this particular mix of ideas has turned out in the current R language and supporting software, the paper will first review the basic ideas behind object-oriented and functional programming, and then examine the evolution of R with these ideas providing context. Functional programming supports well-defined, defensible software giving reproducible results. Object-oriented programming is the mechanism par excellence for managing complexity while keeping things simple for the user. The two paradigms have been valuable in supporting major software for fitting models to data and numerous other statistical applications. The paradigms have been adopted, and adapted, distinctively in R. Functional programming motivates much of R but R does not enforce the paradigm. Object-oriented programming from a functional perspective differs from that used in non-functional languages, a distinction that needs to be emphasized to avoid confusion. R initially replicated the S language from Bell Labs, which in turn was strongly influenced by earlier program libraries. At each stage, new ideas have been added, but the previous software continues to show its influence in the design as well. Outlining the evolution will further clarify why we currently have this somewhat unusual combination of ideas.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。