Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Functional Kotlin makes Kotlin functional

Functional Kotlin makes Kotlin functional

KotlinConf 2023 Global in Songdo에서 발표한 코틀린 함수형 프로그래밍 발표 자료입니다.

HyunWoo Lee

May 12, 2023
Tweet

More Decks by HyunWoo Lee

Other Decks in Programming

Transcript

  1. ೣࣻഋ ೐۽Ӓې߁җ য়೧ Lambda Algebra Monoid Functor / Applicative Functor

    Tail recursion Currying ੿݈ ੉ѱ पઁ ѐߊী ੄޷о ੓ਸөਃ?
  2. Why we should use it? ೣࣻഋ ೐۽Ӓې߁ਸ ഝਊೞݶ ௏٘ܳ рѾೞѱ

    ੘ࢿೡ ࣻ ੓Ҋ ӝמ੄ ഛ੢੉ ए਋ݴ ࠁ׮ উ੹ೠ ௏٘ܳ ੘ࢿೡ ࣻ ੓׮
  3. ਫ਼Ӭ! ੉Ѣ ೣࣻഋ ೐۽Ӓې߁੉ ݏաਃ? Functional Programming is sometimes treated

    as synonymous with Purely functional programming. When a pure function is called with some given arguments, it will always return the same result, and cannot be affected by any mutable state or other side effect. - Hudak, Paul (Conception, evolution and application of functional programming lauguages)
  4. function sum(x: int, y: int) ( 2, 5 ) 7

    ੑ۱੉ زੌೞݶ Ѿҗо ೦࢚ э਷ ೣࣻܳ ࣽࣻ ೣࣻ ( Pure Function) ۄ ೠ׮ Pure Function and Side Effect
  5. Pure Function and Side Effect ೣࣻ ղীࢲ ҙ੢ೞ૑ ঋח, ੹৉

    ࢚క/߸ࣻ ഑਷ (౵ੌ, ചݶ) ੑ୹۱١ਸ ನೣೠ ৻ࠗ ࢚కী ৔ೱਸ ઴ ࣻ ੓Ҋ ੉ܳ ҙ଴ೞח ೯ਤܳ ನೣೞח ೣࣻܳ Side Effectۄ ೠ׮.
  6. Pure Function and Side Effect ೣࣻഋ ೐۽Ӓې߁ਸ ഝਊೞݶ ௏٘ܳ рѾೞѱ

    ੘ࢿೡ ࣻ ੓Ҋ ӝמ੄ ഛ੢੉ ए਋ݴ ࠁ׮ উ੹ೠ ௏٘ܳ ੘ࢿೡ ࣻ ੓׮
  7. Pure Function and Side Effect ࣽࣻೣࣻܳ ࢎਊೞݶ زੌೠ Ѿҗܳ ৘ஏೡ

    ࣻ ੓ਵ޲۽ (ଵઑ ైݺࢿ) ೣࣻ Ӓ ੗୓ܳ ݽٕചػ ӝמਵ۽ ࢎਊೡ ࣻ ੓׮. ژೠ ৻ࠗ о߸ ࢚కܳ ߸҃ೞ૑ ঋਵ޲۽ زदࢿ ೐۽Ӓې߁ীࢲ ҕਬ ੗ਗ ߸҃ী ؀ೠ ҙबࢎܳ ઁೡ ࣻ ੓׮. ੉۠ ੉੼ਵ۽ ೣࣻഋ ೐۽Ӓې߁ীࢲח ࣽࣻ ೣࣻ੄ ࢎਊਸ ૑ೱೠ׮.
  8. Aspect of Functional Programming ৻ࠗ ࣁ҅ܳ ߸҃ਸ दெঠ ೞա ߸҃ਸ

    दఃח ࠗ࠙ਸ ୭ࣗചೞҊ ҳ࠙(Ѻܻ)दః੗
  9. Ҋରೣࣻܳ ഝਊೠ ӝמ ഛ੢ CSVо ইצ ׮ܲ ౵ੌ ഋध ഑਷

    Plain Text۽ Append ೞח ӝמ੉ ୶оػ׮ݶ?
  10. ઺р ੼Ѩ ਸ ੉೧ೞҊ ࢎਊ೧ঠೡ ૑ ঌইঠ ೞݴ Ӓ ੉റী

    ޖ঺੉ ੓ח ૑ ౵ঈ೧ب ן૑ ঋ׮ ݾ੸ যڌѱ
  11. More, Functional Programming Ҋରೣࣻܳ ഝਊೞৈ ੤ࢎਊࢿਸ ՑযৢܻҊ ࠁ׮ ؊ উ੿੸ਵ۽

    ೐۽Ӓې߁ਸ ೞҊ र׮ݶ? Ҋରೣࣻܳ ഝਊೞח ё୓(ё୓ ஶప੉ց)੄ ౠࢿਸ ঌҊ, ੉ܳ ഝਊೞݶ ػ׮
  12. Monad ਽ਊ: ৈ۞ ா੉झܳ ೠ ଃਵ۽ ী۞ ߊࢤ द ী۞

    ఋੑਸ Monad ఋੑਵ۽ ೠߣ ؊ хऱળ׮ݶ?
  13. Monadܳ ഝਊೠ ࢚క ୊ܻ੄ ੉੼ Monad ղࠗ ࢚కܳ ইח Ѫҗ

    ࢚ҙহ੉ ѐߊ੗о ۽૒ਸ ୓੉׬೧ب ޙઁо হب۾ ୊ܻ ೡ ࣻ ੓׮