ko.wikipedia.org/wiki/%EB%A9%B1%EB%93%B1%EB%B2%95%EC%B9%99
๋ฉฑ๋ฑ๋ฒ์น - ์ํค๋ฐฑ๊ณผ, ์ฐ๋ฆฌ ๋ชจ๋์ ๋ฐฑ๊ณผ์ฌ์
์ํค๋ฐฑ๊ณผ, ์ฐ๋ฆฌ ๋ชจ๋์ ๋ฐฑ๊ณผ์ฌ์ . ๋ฉฑ๋ฑ๋ฒ์น(ๅช็ญๆณๅ) ๋๋ ๋ฉฑ๋ฑ์ฑ(ๅช็ญๆง, ์์ด: idempotent)์ ์ํ์ด๋ ์ ์ฐํ์์ ์ฐ์ฐ์ ํ ์ฑ์ง์ ๋ํ๋ด๋ ๊ฒ์ผ๋ก, ์ฐ์ฐ์ ์ฌ๋ฌ ๋ฒ ์ ์ฉํ๋๋ผ๋ ๊ฒฐ๊ณผ๊ฐ ๋ฌ๋ผ
ko.wikipedia.org
๋ฉฑ๋ฑ๋ฒ์น, ๋ฉฑ๋ฑ์ฑ
์ฐ์ฐ์ ์ฌ๋ฌ๋ฒ ์ ์ฉํด๋ ๊ฒฐ๊ณผ๋ ๊ฐ์ ์ฑ์ง
๋ฉฑ๋ฑ์ฑ์ด ์๋ ํจ์๋ ๋ฉฑ๋ฑ ํจ์(idempotent function)๋ผ๊ณ ๋ถ๋ฆ
๋จํญ์ฐ์ฐ
๋จํญ์ฐ์ฐ f, ์ด๋ค ์งํฉ S์ ๋ชจ๋ ์์๋ x
f(f(x)) = f(x)
์ดํญ์ฐ์ฐ
์ดํญ์ฐ์ฐ โ , ์ด๋ค ์งํฉ S์ ๋ชจ๋ ์์ x
xโ x = x
ํ๋ก๊ทธ๋๋ฐ์์ ๋ฉฑ๋ฑ์ฑ
ํจ์๋ฅผ ์ฌ๋ฌ๋ฒ ํธ์ถํด๋ ํ ๋ฒ๋ง ํธ์ถํ ๊ฒ๊ณผ ๋์ผํ ๊ฒฐ๊ณผ๊ฐ ๋ฐํ๋๋ค.
mortoray.com/2014/09/05/what-is-an-idempotent-function/
What is an idempotent function?
Idempotence is an essential tool in programming. It has many uses, from improving fault tolerance, clarifying code, to writing declarative deployment scripts. It’s important to understand wha…
mortoray.com
์์
import kotlin.math.floor
fun main() {
val a = 10.3
println(floor(a)) // 10.0
println(floor(a)) // 10.0
}
import kotlin.math.floor
fun main() {
val a = 10.3
println(floor(a)) // 10.0
println(floor(floor(a))) // 10.0
}
'๋น ๊ตฌ๋ฉ ์ฑ์ฐ๊ธฐ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[SonarQube] SonarQube ์ค์น ๊ทธ๋ฆฌ๊ณ ์ค์น ํ์ธ ์ฐ๋นํํ (0) | 2021.02.18 |
---|---|
[Java] Version ๊ต์ฒด (0) | 2021.02.18 |
[Library] Moshi Converter (0) | 2021.02.18 |
[Java] Class.java public boolean isAssignableFrom(Class<?> cls) (0) | 2021.02.17 |
[Kotlin] ::class.java (0) | 2021.02.17 |