Functional Programming in R 4: Advanced Statistical Programming for Data Science, Analysis, and Finance 2/e
Mailund, Thomas
- 出版商: Apress
- 出版日期: 2023-06-09
- 定價: $1,700
- 售價: 9.5 折 $1,615
- 貴賓價: 9.0 折 $1,530
- 語言: 英文
- 頁數: 158
- 裝訂: Quality Paper - also called trade paper
- ISBN: 1484294866
- ISBN-13: 9781484294864
-
相關分類:
R 語言、Data Science
立即出貨 (庫存=1)
相關主題
商品描述
Master functions and discover how to write functional programs in R. In this book, updated for R 4, you'll learn to make your functions pure by avoiding side effects, write functions that manipulate other functions, and construct complex functions using simpler functions as building blocks.
In Functional Programming in R 4, you'll see how to replace loops, which can have side-effects, with recursive functions that can more easily avoid them. In addition, the book covers why you shouldn't use recursion when loops are more efficient and how you can get the best of both worlds.
Functional programming is a style of programming, like object-oriented programming, but one that focuses on data transformations and calculations rather than objects and state. Where in object-oriented programming you model your programs by describing which states an object can be in and how methods will reveal or modify that state, in functional programming you model programs by describing how functions translate input data to output data. Functions themselves are considered to be data you can manipulate and much of the strength of functional programming comes from manipulating functions; that is, building more complex functions by combining simpler functions.
What You'll Learn
- Write functions in R 4, including infix operators and replacement functions
- Create higher order functions
- Pass functions to other functions and start using functions as data you can manipulate
- Use Filer, Map and Reduce functions to express the intent behind code clearly and safely
- Build new functions from existing functions without necessarily writing any new functions, using point-free programming
- Create functions that carry data along with them
Who This Book Is For
Those with at least some experience with programming in R.
商品描述(中文翻譯)
在這本更新至 R 4 的書籍中,您將學習如何在 R 中撰寫功能函式,並使您的函式成為純函式,避免副作用,撰寫能操作其他函式的函式,並使用較簡單的函式作為構建塊來建構複雜函式。
在《Functional Programming in R 4》中,您將看到如何用遞迴函式取代可能具有副作用的迴圈,以更輕鬆地避免副作用。此外,本書還介紹了為什麼在效能更高的情況下不應使用遞迴,以及如何兼顧兩者的優點。
函數式編程是一種編程風格,類似於物件導向編程,但它更關注於數據轉換和計算,而不是物件和狀態。在物件導向編程中,您通過描述物件可能處於的狀態以及方法如何顯示或修改該狀態來建模程序,而在函數式編程中,您通過描述函數如何將輸入數據轉換為輸出數據來建模程序。函數本身被視為可以操作的數據,函數式編程的優勢很大程度上來自於操作函數,即通過組合較簡單的函數來構建更複雜的函數。
您將學到的內容包括:
- 在 R 4 中撰寫函式,包括中綴運算符和替換函式
- 創建高階函式
- 將函式傳遞給其他函式,並開始使用函式作為可以操作的數據
- 使用 Filer、Map 和 Reduce 函式清晰且安全地表達代碼意圖
- 使用點無形式編程,從現有函式構建新函式,而無需撰寫任何新函式
- 創建可以攜帶數據的函式
本書適合至少具有一些 R 編程經驗的讀者。
作者簡介
Thomas Mailund is Senior Software Architect at Kvantify, a quantum computing company from Denmark. He has a background in math and computer science. He now works on developing algorithms for computational problems applicable for quantum computing. He previously worked at the Bioinformatics Research Centre, Aarhus University, on genetics and evolutionary studies, particularly comparative genomics, speciation, and gene flow between emerging species. He has published Beginning Data Science in R with Apress, as well as other books out there.
作者簡介(中文翻譯)
Thomas Mailund是丹麥量子計算公司Kvantify的高級軟體架構師。他具有數學和計算機科學的背景。他目前致力於開發適用於量子計算的計算問題算法。他曾在奧胡斯大學的生物信息學研究中心從事遺傳學和進化研究,尤其是比較基因組學、物種形成和新興物種之間的基因流。他與Apress合作出版了《Beginning Data Science in R》等書籍。