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

第2回 スタートHaskell2 3. 関数の構文

第2回 スタートHaskell2 3. 関数の構文

mizu__tama

July 22, 2012
Tweet

More Decks by mizu__tama

Other Decks in Programming

Transcript

  1. ୈষ
    ؔ਺ͷߏจ
    !NJ[V@@UBNB
    ਫ໺चق
    12೥7݄22೔೔༵೔

    View Slide

  2. ؔ਺Λॻͨ͘Ίͷߏจ
    wύλʔϯϚον
    wΨʔυ
    wXIFSFઅ
    wMFUࣜ
    wDBTFࣜ
    12೥7݄22೔೔༵೔

    View Slide

  3. ؔ਺Λॻͨ͘Ίͷߏจ
    wύλʔϯϚον
    wΨʔυ
    wXIFSFઅ
    wMFUࣜ
    wDBTFࣜ
    12೥7݄22೔೔༵೔

    View Slide

  4. ύλʔϯϚον

    w ύλʔϯʹैͬͯσʔλΛ
    ෼ղ͢ΔͨΊʹ࢖͏
    w ਺஋ɺจࣈɺϦετɺλϓϧͳͲ
    ༷ʑͳσʔλܕͰ࢖͑Δ
    12೥7݄22೔೔༵೔

    View Slide

  5. ύλʔϯϚον
    w্͔ΒॱʹධՁ͢Δ
    wY͸೚ҙͷ஋ʹ߹க
    ύλʔϯϚον

    12೥7݄22೔೔༵೔

    View Slide

  6. ύλʔϯϚον
    w্͔ΒॱʹධՁ͞ΕΔ
    wY͸೚ҙͷ஋ʹ߹க
    ύλʔϯϚον

    Ӭԕʹ
    ࢖ΘΕͳ͍
    12೥7݄22೔೔༵೔

    View Slide

  7. ύλʔϯϚον
    wY͸ؔ਺ຊମͰࢀরͰ͖Δ
    ύλʔϯϚον

    12೥7݄22೔೔༵೔

    View Slide

  8. ࠶ؼͱύλʔϯϚον

    OOº O

    w࠶ؼతͳؔ਺ͷఆٛʹ΋
    ύλʔϯϚονΛ࢖͏
    wৄ͘͠͸ষͰ
    12೥7݄22೔೔༵೔

    View Slide

  9. ύλʔϯϚονͷࣦഊ
    ύλʔϯ͕
    ໢ཏతͰͳ͍Α
    12೥7݄22೔೔༵೔

    View Slide

  10. ͪͳΈʹ
    ITϑΝΠϧͷઌ಄ʹ͚͓ͭͯ͘ͱ
    ͍Ζ͍Ζܯࠂͯ͘͠ΕΔ
    12೥7݄22೔೔༵೔

    View Slide

  11. λϓϧͷύλʔϯϚον
    λϓϧͷཁૉΛ෼ղͯ͠
    ద੾ͳ໊લΛ͚ͭΔ
    12೥7݄22೔೔༵೔

    View Slide

  12. λϓϧͷύλʔϯϚον
    λϓϧͷཁૉΛ෼ղͯ͠
    ద੾ͳ໊લΛ͚ͭΔ
    ύλʔϯϚονΛ
    ࢖͏ͱಡΈ΍͍͢
    12೥7݄22೔೔༵೔

    View Slide

  13. ϦετͷύλʔϯϚον

    Ϧετ಺แදهͰ΋ύλʔϯϚον
    wࣦഊͨ͠Β࣍ͷཁૉʹਐΉ
    wࣦഊͨ͠ཁૉ͸݁ՌͷϦετʹ
    ؚ·Εͳ͍
    12೥7݄22೔೔༵೔

    View Slide

  14. ϦετͷύλʔϯϚον

    wۭϦετ<>
    wΛؚΉύλʔϯ
    ʢYYTɼYZZTɼYZ<>ͳͲʣ
    wԋࢉࢠ͸࢖͑ͳ͍
    YTZT

    12೥7݄22೔೔༵೔

    View Slide

  15. ϦετͷύλʔϯϚον

    wۭϦετ<>
    wΛؚΉύλʔϯ
    ʢYYTɼYZZTɼYZ<>ͳͲʣ
    wԋࢉࢠ͸࢖͑ͳ͍
    YTZT


    Λ๨Εͣʹʂ
    12೥7݄22೔೔༵೔

    View Slide

  16. BTύλʔϯ
    ஋Λύλʔϯʹ෼ղͭͭ͠ɺ
    ύλʔϯϚονͷର৅ʹͳͬͨ
    ஋ࣗମ΋ࢀর͍ͨ͠ͱ͖ʹ࢖͏ɻ
    શମͷ໊લˏී௨ͷύλʔϯ
    12೥7݄22೔೔༵೔

    View Slide

  17. BTύλʔϯ
    ஋Λύλʔϯʹ෼ղͭͭ͠ɺ
    ύλʔϯϚονͷର৅ʹͳͬͨ
    ஋ࣗମ΋ࢀর͍ͨ͠ͱ͖ʹ࢖͏ɻ
    l)BTLFMMz `)`
    lBTLFMMz
    l)BTLFMMz
    Y
    YT
    BMM
    12೥7݄22೔೔༵೔

    View Slide

  18. BTύλʔϯ
    ஋Λύλʔϯʹ෼ղͭͭ͠ɺ
    ύλʔϯϚονͷର৅ʹͳͬͨ
    ஋ࣗମ΋ࢀর͍ͨ͠ͱ͖ʹ࢖͏ɻ
    < >
    < >
    < >
    Y
    YT
    BMM
    12೥7݄22೔೔༵೔

    View Slide

  19. ؔ਺Λॻͨ͘Ίͷߏจ
    wύλʔϯϚον
    wΨʔυ
    wXIFSFઅ
    wMFUࣜ
    wDBTFࣜ
    12೥7݄22೔೔༵೔

    View Slide

  20. Ψʔυ
    Ҿ਺ͷ஋͕ຬͨ͢ੑ࣭ʹΑͬͯ
    ৔߹෼͚͢Δͱ͖ʹ࢖͏ɻ
    12೥7݄22೔೔༵೔

    View Slide

  21. Ψʔυ
    CNJ5FMM
    Ҿ਺ͷ஋͕ຬͨ͢ੑ࣭ʹΑͬͯ
    ৔߹෼͚͢Δͱ͖ʹ࢖͏ɻ
    12೥7݄22೔೔༵೔

    View Slide

  22. Ψʔυ

    CNJ5FMM
    Ҿ਺ͷ஋͕ຬͨ͢ੑ࣭ʹΑͬͯ
    ৔߹෼͚͢Δͱ͖ʹ࢖͏ɻ
    12೥7݄22೔೔༵೔

    View Slide

  23. Ψʔυ

    'BMTF
    CNJ5FMM
    Ҿ਺ͷ஋͕ຬͨ͢ੑ࣭ʹΑͬͯ
    ৔߹෼͚͢Δͱ͖ʹ࢖͏ɻ
    12೥7݄22೔೔༵೔

    View Slide

  24. Ψʔυ
    Ҿ਺ͷ஋͕ຬͨ͢ੑ࣭ʹΑͬͯ
    ৔߹෼͚͢Δͱ͖ʹ࢖͏ɻ
    CNJ5FMM
    l:PVSFTVQQPTFEMZOPSNBM1⒎GU *CFUZPVVHMZz

    12೥7݄22೔೔༵೔

    View Slide

  25. Ψʔυ
    Ҿ਺ͷ஋͕ຬͨ͢ੑ࣭ʹΑͬͯ
    ৔߹෼͚͢Δͱ͖ʹ࢖͏ɻ
    CNJ5FMM
    l:PVSFTVQQPTFEMZOPSNBM1⒎GU *CFUZPVVHMZz

    5SVF
    12೥7݄22೔೔༵೔

    View Slide

  26. PUIFSXJTF
    ͢΂ͯΛΩϟον͢Δɻ
    12೥7݄22೔೔༵೔

    View Slide

  27. Ψʔυͱύλʔϯ
    12೥7݄22೔೔༵೔

    View Slide

  28. Ψʔυͱύλʔϯ
    ύλʔϯ
    ύλʔϯ
    ύλʔϯ
    ύλʔϯ
    ৚݅
    ৚݅
    ৚݅
    ৚݅
    12೥7݄22೔೔༵೔

    View Slide

  29. ؔ਺Λॻͨ͘Ίͷߏจ
    wύλʔϯϚον
    wΨʔυ
    wXIFSFઅ
    wMFUࣜ
    wDBTFࣜ
    12೥7݄22೔೔༵೔

    View Slide

  30. XIFSFઅ

    ܭࢉͷதؒ݁Ռʹ໊લΛ͚ͭΔ
    12೥7݄22೔೔༵೔

    View Slide

  31. 12೥7݄22೔೔༵೔

    View Slide

  32. XIFSFઅ

    w ෳ਺ͷม਺͕ఆٛͰ͖Δ
    w Πϯσϯτ͸ଗ͑Δ
    12೥7݄22೔೔༵೔

    View Slide

  33. XIFSFͷείʔϓ
    ͻͱͭͷύλʔϯ಺ͰͷΈ༗ޮ
    12೥7݄22೔೔༵೔

    View Slide

  34. XIFSFͷείʔϓ
    ͻͱͭͷύλʔϯ಺ͰͷΈ༗ޮ
    ͓͜ΒΕΔʂ
    12೥7݄22೔೔༵೔

    View Slide

  35. ύλʔϯϚονͱXIFSF
    12೥7݄22೔೔༵೔

    View Slide

  36. ύλʔϯϚονͱXIFSF
    λϓϧͷ
    ύλʔϯϚον
    12೥7݄22೔೔༵೔

    View Slide

  37. ύλʔϯϚονͱXIFSF
    λϓϧͷ
    ύλʔϯϚον
    Ϧετͷ
    ύλʔϯϚον
    12೥7݄22೔೔༵೔

    View Slide

  38. XIFSFϒϩοΫͷதͷؔ਺
    12೥7݄22೔೔༵೔

    View Slide

  39. XIFSFϒϩοΫͷதͷؔ਺
    ఆٛ
    12೥7݄22೔೔༵೔

    View Slide

  40. XIFSFϒϩοΫͷதͷؔ਺
    ݺͼग़͠
    12೥7݄22೔೔༵೔

    View Slide

  41. ؔ਺Λॻͨ͘Ίͷߏจ
    wύλʔϯϚον
    wΨʔυ
    wXIFSFઅ
    wMFUࣜ
    wDBTFࣜ
    12೥7݄22೔೔༵೔

    View Slide

  42. MFUࣜ

    ܭࢉͷதؒ݁Ռʹ໊લΛ͚ͭΔ
    12೥7݄22೔೔༵೔

    View Slide

  43. MFUࣜ

    ܭࢉͷதؒ݁Ռʹ໊લΛ͚ͭΔ
    தؒ݁Ռ
    12೥7݄22೔೔༵೔

    View Slide

  44. MFUࣜ

    ܭࢉͷதؒ݁Ռʹ໊લΛ͚ͭΔ
    ࠷ऴ݁Ռ
    12೥7݄22೔೔༵೔

    View Slide

  45. MFUࣜ

    ܭࢉͷதؒ݁Ռʹ໊લΛ͚ͭΔ
    ࠷ऴ݁Ռ
    தؒ݁Ռ
    ࠷ऴ݁Ռ
    தؒ݁Ռ
    12೥7݄22೔೔༵೔

    View Slide

  46. MFUࣜ

    wʮࣜʯͰ͋Δ஋Λ࣋ͭ
    ɹ㱺ίʔυதͷ΄ͱΜͲͲΜͳ৔ॴͰ΋
    ɹɹ࢖͑Δ
    12೥7݄22೔೔༵೔

    View Slide

  47. MFUࣜ

    wʮࣜʯͰ͋Δ஋Λ࣋ͭ
    ɹ㱺ίʔυதͷ΄ͱΜͲͲΜͳ৔ॴͰ΋
    ɹɹ࢖͑Δ

    12೥7݄22೔೔༵೔

    View Slide

  48. MFUࣜͷศརͳ࢖͍ํ

    wϩʔΧϧείʔϓʹؔ਺Λ࡞Δ
    wηϛίϩϯͰ۠੾ͬͯ࢖͏
    12೥7݄22೔೔༵೔

    View Slide

  49. MFUࣜͷศརͳ࢖͍ํ

    wMFUࣜʴύλʔϯϚον
    λϓϧΛཁૉʹ෼ղ
    wϦετ಺แදهͰ࢖͏
    wग़ྗʢcΑΓલͷ෦෼ʣ
    wMFUΑΓޙΖͷϦετ಺แදه͢΂ͯ
    ɹ
    12೥7݄22೔೔༵೔

    View Slide

  50. ()$JͰͷMFU
    w()$JͰ͸JOͷ෦෼ΛলུͰ͖Δ
    wলུ͢Δͱఆ໊ٛͨ͠લ͸
    Ҏ߱ͷηογϣϯશମ͔Βݟ͑Δ
    12೥7݄22೔೔༵೔

    View Slide

  51. ؔ਺Λॻͨ͘Ίͷߏจ
    wύλʔϯϚον
    wΨʔυ
    wXIFSFઅ
    wMFUࣜ
    wDBTFࣜ
    12೥7݄22೔೔༵೔

    View Slide

  52. DBTFࣜ

    wࢦఆͨ͠஋ʹର͢Δ
    ίʔυϒϩοΫΛධՁͰ͖Δ
    wʮࣜʯͰ͋Δ஋Λ࣋ͭ
    wύλʔϯϚον΋࢖͑Δ
    12೥7݄22೔೔༵೔

    View Slide

  53. DBTFࣜ
    12೥7݄22೔೔༵೔

    View Slide

  54. ؔ਺Λॻͨ͘Ίͷߏจ
    wύλʔϯϚον
    wΨʔυ
    wXIFSFઅ
    wMFUࣜ
    wDBTFࣜ
    12೥7݄22೔೔༵೔

    View Slide