- Hands-On Functional Programming with TypeScript
- Remo H. Jansen
- 141字
- 2021-07-02 14:03:10
Referential transparency
Referential transparency is another concept closely related to pure functions and side-effects. A function is pure when it is free from side-effects. An expression is said to be referentially transparent when it can be replaced with its corresponding value without changing the application's behavior. For example, if we are using the following in our code:
let result = isIndexPage("/");
We know that the isIndexPage function is referentially transparent because it would be safe to substitute it for its return type. In this case, we know that when we invoke the isIndexPage function with / as an argument, the function will always return true, which means that it would be safe to do the following:
let result = true;
A pure function is a referentially transparent expression. An expression that is not referentially transparent is known as referentially opaque.
- Node.js 10實戰
- SQL Server 2012數據庫技術及應用(微課版·第5版)
- 軟件工程
- 從0到1:Python數據分析
- Getting Started with Greenplum for Big Data Analytics
- 移動界面(Web/App)Photoshop UI設計十全大補
- 軟件測試實用教程
- Python+Tableau數據可視化之美
- 基于SpringBoot實現:Java分布式中間件開發入門與實戰
- 從零開始:UI圖標設計與制作(第3版)
- Python語言科研繪圖與學術圖表繪制從入門到精通
- Learning Android Application Testing
- Software-Defined Networking with OpenFlow(Second Edition)
- C# 7.0本質論
- Node.js 6.x Blueprints