[ν¨μν νλ‘κ·Έλλ°] μν λ³ν eta conversion
μΆμ²
ChatGPT
https://sookocheff.com/post/fp/eta-conversion/
Eta Reduction
The purpose of eta reduction (also written \(\eta\)-reduction) is to drop an abstraction over a function to simplify it. This is possible when there is nothing more that a function can do to its argument. For example, imagine that we have a simple function
sookocheff.com
https://library.fiveable.me/key-terms/programming-languages-iii/eta-conversion
Eta conversion - (Programming Techniques III) - Vocab, Definition, Explanations | Fiveable
Eta conversion is a process in lambda calculus where a function is considered equivalent to another function if they behave identically when applied to an argument. This concept reflects the principle that a function that takes an argument and returns anot
library.fiveable.me
μν λ³ν Eta Conversion
ν¨μμ ννλ₯Ό μ½κ° λ³νν΄λ κ·Έ ν¨μμ μλ―Έκ° λ³νμ§ μμμ λνλ΄λ κ°λ .
etaλ κ·Έλ¦¬μ€ μνλ²³ ημ΄λ€.
μν λ³νμ νμ₯κ³Ό μΆμ½ λ κ°μ§λ‘ λλλ€.
1. μν νμ₯ eta expansion
μ£Όμ΄μ§ ν¨μ fμ λν΄ ν¨μμ μ μλ₯Ό λͺ μμ μΌλ‘ νμ₯νλ λ°©μμ΄λ€.
2. μν μΆμ½ eta reduction
μν νμ₯μ λ°λ κ°λ μΌλ‘, ν¨μ ννμμ λΆνμν μΈμ μ μ©μ μ κ±°νλ λ³νμ΄λ€.
μλ₯Ό λ€μ΄, κ°λ¨ν ν¨μ f x = g x λ₯Ό μκ°ν΄λ³΄μ. fμ gλ κ°μ μΈμ xλ₯Ό κ°μ§κ³ μκ³ , μ΄ ν¨μμ κ²°κ³Ό κ°μ κ°λ€. fμ gκ° κ°μ μΈμλ₯Ό κ°μ§κ³ κ°μ κ°μ μμ±νκΈ° λλ¬Έμ, μ°λ¦¬λ λ°©μ μμ f = g λΌκ³ λ¨μνν μ μλ€.
μν λ³νμ ν΅μ¬
μν λ³νμ λ ν¨μκ° κ°μ κ²°κ³Όλ₯Ό λ§λ€μ΄ λ΄λ ν, λμΌν ν¨μλ‘ μ·¨κΈλ μ μμμ 보μ₯νλ€.
μ΄ λ³νμ ν¨μν νλ‘κ·Έλλ°μμ μ€μν μ΄λ‘ μ κΈ°λ°μ΄ λλ€. νΉν ν¨μμ μ μμ μ¬μ©μ κ°λ¨νκ² λ€λ£¨κΈ° μν μ΅μ ν λ° ν¨μ ν©μ±μμ μμ£Ό μ¬μ©λλ€.
μμ
val f: (Int) -> Int = { x -> x + 1 }
// μν νμ₯: fλ₯Ό λͺ
μμ μΌλ‘ νμ₯
val g: (Int) -> Int = { x -> f(x) }
// μν μΆμ½: gλ κ²°κ΅ fμ λμΌν¨
val h: (Int) -> Int = f