Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Recap Pointfree Vol. 1~3

Recap Pointfree Vol. 1~3

https://gist.github.com/freddi-kit/112b3d13c6660339ddc85bd05ffc3c2b に Vol 3 で話す予定だったものあり

freddi(Yuki Aki)

October 25, 2020
Tweet

More Decks by freddi(Yuki Aki)

Other Decks in Programming

Transcript

  1. 2020/10/25
    Recap Pointfree Vol. 1~3
    iOSΞϓϦ։ൃͷͨΊͷFunctional Architecture৘ใڞ༗ձ

    View Slide

  2. ࠓճͷRecapͷ΍Γํ
    • Pointfree Episode Vol 1 ~ 3 ͷ಺༰Λ΍͍͖ͬͯ·͢

    • ͨͩ͠ɺ͢΂ͯ΍Δͷ͸͕࣌ؒڐ͢ݶΓ

    • ొஃऀͷPlaygroundͰRecapͨ͠Γ༡ΜͰ͍͖·͢

    • ղઆ͠ͳ͕Β΍ΔͷͰʮ͜͏͍͏ͷͰ͖Δʁʯ

    ͱ͔৭ʑ஡ʑΛೖΕΔͷ͓͢͢ΊͰ͢

    View Slide

  3. Pointfree ͱ͸
    • ϓϩάϥϛϯάݴޠSwiftʹؔ͢ΔಈըͷγϦʔζ

    • ؔ਺ܕϓϩάϥϛϯάͱSwiftʹ͍ͭͯղઆ

    • Ұ෦Τϐιʔυ͸ߪಡ͕ඞਢ

    • https://www.pointfree.co/

    View Slide

  4. “pointfree” ͱ͸
    • pointfree ͱ͍͏୯ޠࣗମʹ͍ͭͯ΋ҙຯ͕͋Δ

    View Slide

  5. pointfree-style
    • Haskellͷؔ਺ͷॻ͖ํʢελΠϧʣ

    • … So a 'points-free' definition of a function is one
    which does not explicitly mention the points (values)
    of the space on which the function acts.

    • … ͳͷͰɺʮpointfreeʯ ʹΑΔఆٛͱ͸ؔ਺͕࡞༻
    ͢ΔۭؒͰɺ஋ʹ͸໌ࣔతʹ͸ݴٴ͠ͳ͍ఆٛΛ͞
    ͍ͯ͠·͢ɻ

    View Slide

  6. pointfree-style
    • ͨͱ͑͹ɺHaskell ͷ͜ͷॻ͖ํ
    f x = x + 1
    Sun

    View Slide

  7. pointfree-style
    • ஋(point) ʹݴٴ͠ͳ͍ॻ͖ํͩͱ͜͏ॻ͚Δ

    • ͜Ε͕ઌఔͷ f ͷpointfree style
    f = (+ 1)
    Sun

    View Slide

  8. “pointfree” ͱ͸
    • ༨ஊͰ͋ΓDeep Dive͢Δͱ࿩͕௕͘ͳΔͷͰׂѪ

    View Slide

  9. ࠓ೔࿩͢Pointfree ͷ Episode ʹ͍ͭͯ
    • Vol 1. Functions

    • Vol 2. Side Effects

    • Vol 3. UIKit Styling with Functions

    View Slide

  10. Vol 1. Functions
    • ͪΐͬͱมΘͬͨελΠϧͷؔ਺ʹؔ͢Δॻ͖ํ

    • ͜Ε͔Βͷ Episode ΛݟΔ্Ͱඞਢͷ಺༰

    • ৽͍͠ԋࢉࢠͷ঺հ

    • |> ʹΑΔؔ਺ద༻, >>> ʹΑΔؔ਺ͷ߹੒

    View Slide

  11. Vol 1. Functions
    • ݸਓతͳײಈ఺

    • ֤ԋࢉࢠʹΑΔ, left-to-right ͳίʔυͷ࡞੒

    • ؔ਺Λ “Composition” ͢Δͱ͍͏ߟ͑ํ

    View Slide

  12. Vol 2. Side Effects
    • ʮ෭࡞༻Λ੍ޚ͢ΔʯʹϑΥʔΧεͨ͠ Episode

    • print ͷྫ

    • NumberFormatter ͷྫ

    • ԋࢉࢠ >=> ʹΑΔEffectΛ࣋ͬͨؔ਺ͷ߹੒

    • ԋࢉࢠ <> ʹΑΔؔ਺ͷ߹੒ɺ<> ͷ ΦʔόʔϥΠυ

    View Slide

  13. Vol 3. UIKit Styling with Functions
    • ࠓ·Ͱशͬͨ͜ͱΛͲͷΑ͏ʹ׆͔ͤΔ͔ʁ

    • ࣮ࡍʹίʔυ͕Massive ʹͳΓͦ͏ͳUIViewͷྫ

    View Slide

  14. ࢀߟࢿྉ
    • https://www.pointfree.co/

    • https://wiki.haskell.org/Pointfree

    View Slide