almost 4 years ago

9/4 去參加了 Function Thursday 的 Meetup。

這次主題試著以 Bottom Up 的角度來介紹 Functional Programming 應有的思維。主要的內容圍繞在 Lambda Calculus。對我來說,這是個還蠻陌生的主題。先紀錄下網路找到的關鍵字。

Definition

Let E be a λ-expression (or a λ-term), if E is

  1. Any variables: x, y
  2. An abstract function: λx.E. In Python, we use lambda:
    lambda x: E
    
  3. A function application: Abritary composition of λ-expression, e.g., (E1 E2).

Substitution

  1. α reduction
  2. β reduction

Examples

Given a syntactic sugar declaration

let x = a in 
let y = λz.x in
let x = b in
y x

It turns out

let x = b in y x    => (λx.y x) b      => yb
let y = lz.x in yb => (λy.yb) (λz.x) => yb [λz.x/y] => λz.xb
let x = a in λz.xb => (λx.λz.xb) a   => λz.ab

參考資料

← Pyreverse 簡介 Regular Expression 筆記 →
 
comments powered by Disqus