Functional Programming in R: Advanced Statistical Programming for Data Science, Analysis and Finance
暫譯: R中的函數式程式設計:數據科學、分析與金融的進階統計程式設計

Thomas Mailund

  • 出版商: Apress
  • 出版日期: 2017-03-29
  • 定價: $1,575
  • 售價: 5.0$788
  • 語言: 英文
  • 頁數: 104
  • 裝訂: Paperback
  • ISBN: 148422745X
  • ISBN-13: 9781484227459
  • 相關分類: R 語言Data Science
  • 立即出貨 (庫存 < 3)

買這商品的人也買了...

相關主題

商品描述

Master functions and discover how to write functional programs in R. In this concise book, you'll make your functions pure by avoiding side-effects; you’ll write functions that manipulate other functions, and you’ll construct complex functions using simpler functions as building blocks.
 
In Functional Programming in R, you’ll see how we can 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 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 中編寫函數式程式。在這本簡明的書中,您將通過避免副作用來使您的函數變得純粹;您將編寫操作其他函數的函數,並使用更簡單的函數作為構建塊來構建複雜的函數。

在《Functional Programming in R》中,您將看到如何用遞迴函數取代可能有副作用的迴圈,因為遞迴函數更容易避免這些副作用。此外,本書還涵蓋了為什麼在迴圈更有效率的情況下不應使用遞迴,以及如何獲得兩者的最佳效果。

函數式程式設計是一種程式設計風格,類似於物件導向程式設計,但它專注於數據轉換和計算,而不是物件和狀態。在物件導向程式設計中,您通過描述物件可以處於哪些狀態以及方法如何揭示或修改該狀態來建模您的程式;而在函數式程式設計中,您通過描述函數如何將輸入數據轉換為輸出數據來建模程式。函數本身被視為可以操作的數據,函數式程式設計的強大之處在於操作函數;也就是說,通過組合更簡單的函數來構建更複雜的函數。

您將學到的內容:

- 在 R 中編寫函數,包括中置運算子和替代函數
- 創建高階函數
- 將函數傳遞給其他函數,並開始將函數用作可以操作的數據
- 使用 Filer、Map 和 Reduce 函數清晰且安全地表達代碼背後的意圖
- 從現有函數構建新函數,而不必編寫任何新函數,使用無點編程
- 創建攜帶數據的函數

本書適合對 R 編程有一定經驗的讀者。