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

Scalaつまみ食い - CADDi STUDDi

CADDi
December 10, 2021

Scalaつまみ食い - CADDi STUDDi

CADDi

December 10, 2021
Tweet

More Decks by CADDi

Other Decks in Programming

Transcript

  1. 4DBMBͭ·Έ͙͍

  2. 4DBMBͬͯͲΜͳݴޠʁ 4DBMB͸Ұൠతͳϓϩάϥϛϯάํ๏Λ؆͔ܿͭΤϨΨϯτ͔ͭܕ҆શͳํ๏Ͱදݱ͢ΔͨΊʹઃܭ͞Εͨ ϞμϯͳϚϧνύϥμΠϜݴޠͰ͢ɻͦΕ͸ΦϒδΣΫτࢦ޲ݴޠͱؔ਺ܕݴޠͷػೳΛεϜʔζʹ౷߹͍ͯ͠·͢ɻ #Z4DBMB%PDVNFOUBUJPO IUUQTEPDTTDBMBMBOHPSHKBUPVSUPVSPGTDBMBIUNM º ͢΂ͯͷ஋͕ΦϒδΣΫτ ɾΫϥε ɾτϨΠτ ͢΂ͯͷؔ਺͕஋

    ɾߴ֊ؔ਺ ɾΧϦʔԽ ɾύλʔϯϚονϯά ͋͘·ͰϝΠϯ͸ΦϒδΣΫτࢦ޲ɺͦ͜ʹؔ਺ܕͷΤοηϯεΛ͍͍ײ͡ʹ༥߹͍ͤͯ͞ΔΠϝʔδ ʢݸਓͷײ૝Ͱ͢ʣ ؔ਺ܕ ΦϒδΣΫτࢦ޲
  3. 4DBMBͬͯͲΜͳݴޠʁ w ੩తܕ෇͚ w ܕਪ࿦ w δΣωϦΫε w +BWB7JSUVBM.BDIJOF +7.

    ্Ͱಈ࡞ w 4DBMB͔Β+BWBͷϓϩάϥϜΛݺͼग़ͤΔ w (BSCBHF$PMMFDUJPO ࠓ೔͸4DBMBܥʢYʣͷ࿩Λ͠·͢ 4DBMB΋ग़͍ͯΔͷͰ͕͢ɺ݁ߏ༷มΘΓ͍ͯ͠Δͷͱ ࣮຿ͰऔΓೖΕ͍ͯΔͱ͜ΖΛฉ͔ͳ͍ͷͰʜʢ֤छϥΠϒϥϦ͕ͦΜͳʹରԠͰ͖͍ͯͳ͍ʣ
  4. ͓͠ͳ͕͖ w DMBTT ίϯύχΦϯΦϒδΣΫτ DBTFDMBTT w ඪ४ϥΠϒϥϦ͔Β͍͔ͭ͘঺հ w 4FR 0QUJPO

    w 4DBMBͷνΧϥͷยྡྷ w 0QUJPOܕͷίϯϏωʔγϣϯ w ߴΧΠϯυܕ 4DBMBͷجຊ ʢׂͱ୶ʑͱਐΊΔύʔτʣ 4DBMBͬΆ͞ͷ঺հ ʢϝΠϯίϯςϯπʣ
  5. DMBTT ίϯετϥΫλ WBM WBSΛ͚ͭΔͱϝϯόʔʹͳΔ ࢀߟɿWEB+DB PRESS Vol.112 ࣮ફScala

  6. DMBTT WBM͕͍͍ͭͯΔͷͰެ։͞Ε͍ͯΔ WBSʹ͢ΔͱՄมʹͳΔ QSJWBUFWBMͱ͢Ε͹Ӆ͢͜ͱ΋Ͱ͖Δ

  7. DMBTT WBM͕͍͍ͭͯΔͷͰެ։͞Ε͍ͯΔ WBSʹ͢ΔͱՄมʹͳΔ QSJWBUFWBMͱ͢Ε͹Ӆ͢͜ͱ΋Ͱ͖Δ

  8. DMBTT WBM͕͍͍ͭͯͳ͍ʢϝϯόʔͰͳ͍ʣ ͷͰࢀরͰ͖ͳ͍

  9. DMBTT ϝιουఆٛ 4DBMBͰ͸৽͍͠ΦϒδΣΫτΛฦ͢ ͜ͱ͕ଟ͍ ϝιουͷݺͼํ

  10. ίϯύχΦϯΦϒδΣΫτ ͋ΔΫϥεͱಉ͡৔ॴͰಉ໊ͷΦϒδΣΫτΛఆٛͨ͠΋ͷ ޓ͍ͷϓϥΠϕʔτϝϯόʔʹΞΫηεͰ͖Δ ϓϥΠϕʔτϝϯόʔʹΞΫηεՄ

  11. ίϯύχΦϯΦϒδΣΫτ ͋ΔΫϥεͱಉ͡৔ॴͰಉ໊ͷΦϒδΣΫτΛఆٛͨ͠΋ͷ ޓ͍ͷϓϥΠϕʔτϝϯόʔʹΞΫηεͰ͖Δ 6TFSBQQMZΛݺͼग़͍ͯ͠Δ OFXͰ͸ͳ͍͜ͱʹ஫ҙ 4DBMBͷBQQMZͱVOBQQMZͱ͍͏ϝιου໊ ͸লུͯ͠ݺͼग़͢͜ͱ͕Ͱ͖Δ ͜ͷྫͰ͸6TFSBQQMZ lUBOJHVDIJz 

     ͱಉ͡ҙຯ
  12. DBTFDMBTT ৭ʑศརͳ΋ͷΛੜ΍ͯ͘͠ΕΔ ɾίϯύχΦϯΦϒδΣΫτ͕ੜ੒͞ΕΔ ɾϑΟʔϧυͷ֤߲໨͕WBMએݴͱಉ͡ҙຯΛ࣋ͭ ɾDPQZϝιουΛ࣋ͭ ɾͰͷൺֱ͕͢΂ͯͷϑΟʔϧυ໊ͷ஋͕Ұக͢Δ͔Ͳ͏͔Ͱ൑ผ͞ΕΔ ɾNBUDIͰ࢖༻Ͱ͖Δʹͯ͘͠ΕΔ

  13. ͓͠ͳ͕͖ w DMBTT ίϯύχΦϯΦϒδΣΫτ DBTFDMBTT w ඪ४ϥΠϒϥϦ͔Β͍͔ͭ͘঺հ w 4FR 0QUJPO

    w 4DBMBͷνΧϥͷยྡྷ w 0QUJPOܕͷίϯϏωʔγϣϯ w ߴΧΠϯυܕ 4DBMBͷجຊ ʢׂͱ୶ʑͱਐΊΔύʔτʣ 4DBMBͬΆ͞ͷ঺հ ʢϝΠϯίϯςϯπʣ
  14. 4FRྻΛද͢ίϨΫγϣϯ BQQMZϝιουΛݺͼग़͍ͯ͠Δ ࢀߟɿWEB+DB PRESS Vol.112 ࣮ફScala

  15. 4FRྻΛද͢ίϨΫγϣϯ ୈҾ਺ͷཁૉΛऔಘɻൣғ֎ͳΒୈҾ਺ͷؔ਺Λ࣮ߦ ୈҾ਺ɿ*OU*OUͷؔ਺ Ҿ਺ͷ*OU͸ఴࣈΛද͕͢ࠓճ͸ৗʹΛฦ͢ͷͰ࢖Θͳ͍ͷͰʮ@ʯ

  16. 4FRͷNBQ NBQϝιουͰ۝۝ද

  17. 4FRͷGMBUUFO NBQϝιουͰ۝۝ද fl BUUFOͰೖΕࢠΛͳͯ͘͠4FR<4USJOH>ʹ

  18. 4FRͷGMBU.BQ NBQϝιουͰ۝۝ද fl BUUFOͰೖΕࢠΛͳͯ͘͠4FR<4USJOH>ʹ NBQ  fl BUUFO͸ fl BU.BQͰʂ

  19. GPSࣜͰΑΓݟ΍͘͢ NBQϝιουͰ۝۝ද fl BUUFOͰೖΕࢠΛͳͯ͘͠4FR<4USJOH>ʹ NBQ  fl BUUFO͸ fl BU.BQͰʂ

    GPSࣜ͸ೖΕࢠʹͳͬͨNBQ΍ fl BU.BQͷ γϯλοΫεγϡΨʔ
  20. 0QUJPO<"> ஋͕͋ͬͨΓͳ͔ͬͨΓΛදݱ͢Δܕ ɾ஋͕͋Δˠ4PNF<"> ɾ஋͕ͳ͍ˠ/POF 0QUJPO<4USJOH>Λ࡞ͬͯΈΔ ࢀߟɿWEB+DB PRESS Vol.112 ࣮ફScala

  21. 0QUJPO<">ɿཁૉͷऔಘ ஋͕͋ͬͨΓͳ͔ͬͨΓΛදݱ͢Δܕ ɾ஋͕͋Δˠ4PNF<"> ɾ஋͕ͳ͍ˠ/POF 0QUJPO<4USJOH>Λ࡞ͬͯΈΔ ஋ΛऔΓͩͯ͠ΈΔ ύλʔϯϚονͰ΋͍͚Δ

  22. 0QUJPO<">ɿNBQͰม׵ ஋͕͋ͬͨΓͳ͔ͬͨΓΛදݱ͢Δܕ ɾ஋͕͋Δˠ4PNF<"> ɾ஋͕ͳ͍ˠ/POF 0QUJPO<4USJOH>Λ࡞ͬͯΈΔ NBQϝιουͰม׵ fl BU.BQ΋͋ΔΑ GPSࣜ΋࢖͑ΔΑ

  23. ͓͠ͳ͕͖ w DMBTT ίϯύχΦϯΦϒδΣΫτ DBTFDMBTT w ඪ४ϥΠϒϥϦ͔Β͍͔ͭ͘঺հ w 4FR 0QUJPO

    w 4DBMBͷνΧϥͷยྡྷ w 0QUJPOܕͷίϯϏωʔγϣϯ w ߴΧΠϯυܕ 4DBMBͷجຊ ʢׂͱ୶ʑͱਐΊΔύʔτʣ 4DBMBͬΆ͞ͷ঺հ ʢϝΠϯίϯςϯπʣ
  24. 0QUJPOܕͷίϯϏωʔγϣϯ 0QUJPOܕΛෳ਺૊Έ߹Θͤͯॲཧ͢Δํ๏ΛΈͯΈ·͢ ͓୊ ࣍ͷσʔλߏ଄͔ΒࠃޠͱӳޠΛडߨͨ͠ੜెʹ͍͚ͭͯͩɺ ࠃޠͱӳޠͷฏۉ఺ΛٻΊ໊ͯલͱͱ΋ʹग़ྗͤΑ ग़ྗɿ lKJSPz   lIBOBz

     ͓୊͸ʮWEB+DB PRESS Vol.112 ࣮ફScalaʯΑΓ
  25. BWFSBHFϝιουΛߟ͑Δ ໰ࠃޠͱӳޠΛडߨͨ͠ੜెʹ͍͚ͭͯͩɺ ࠃޠͱӳޠͷฏۉ఺ΛٻΊ໊ͯલ ͱͱ΋ʹग़ྗͤΑ ࢀߟɿWEB+DB PRESS Vol.112 ࣮ફScala

  26. BWFSBHFϝιουΛߟ͑ΔʢJGࣜฤʣ ໰ࠃޠͱӳޠΛडߨͨ͠ੜెʹ͍͚ͭͯͩɺ ࠃޠͱӳޠͷฏۉ఺ΛٻΊ໊ͯલ ͱͱ΋ʹग़ྗͤΑ ࠃޠ΍ӳޠΛडߨͨ͠Γ͍ͯ͠ͳ͔ͬͨΓ͢ΔͷͰ0QUJPOͰදݱͰ͖ͦ͏ ࢀߟɿWEB+DB PRESS Vol.112 ࣮ફScala

  27. BWFSBHFϝιουΛߟ͑Δʢ0QUJPOฤʣ ໰ࠃޠͱӳޠΛडߨͨ͠ੜెʹ͍͚ͭͯͩɺ ࠃޠͱӳޠͷฏۉ఺ΛٻΊ໊ͯલ ͱͱ΋ʹग़ྗͤΑ #FGPSFJGࣜ "GUFS0QUJPONBQ  fl BU.BQ ࢀߟɿWEB+DB

    PRESS Vol.112 ࣮ફScala
  28. BWFSBHFϝιουΛߟ͑ΔʢGPSࣜʣ ໰ࠃޠͱӳޠΛडߨͨ͠ੜెʹ͍͚ͭͯͩɺ ࠃޠͱӳޠͷฏۉ఺ΛٻΊ໊ͯલ ͱͱ΋ʹग़ྗͤΑ #FGPSFJGࣜ "GUFS0QUJPONBQ  fl BU.BQ "GUFSΛGPSࣜͰॻ͘

    ࢀߟɿWEB+DB PRESS Vol.112 ࣮ફScala
  29. ͓·͚ɿ໰ʹՃ͑ͯฏۉ఺఺Ҏ্ͷΈग़ྗ͍ͨ͠৔߹ ໰ࠃޠͱӳޠΛडߨͨ͠ੜెʹ͍͚ͭͯͩɺ ࠃޠͱӳޠͷฏۉ఺ΛٻΊͯ ͦΕ͕఺Ҏ্ͷ৔߹ʹ ໊લͱͱ΋ʹग़ྗͤΑ GPSࣜͰ͜Μͳ;͏ʹॻ͚Δ ࠨͷGPSࣜ͸ҎԼͷγϯλοΫεγϡΨʔ ࢀߟɿWEB+DB PRESS Vol.112

    ࣮ફScala
  30. ͓͠ͳ͕͖ w DMBTT ίϯύχΦϯΦϒδΣΫτ DBTFDMBTT w ඪ४ϥΠϒϥϦ͔Β͍͔ͭ͘঺հ w 4FR 0QUJPO

    w 4DBMBͷνΧϥͷยྡྷ w 0QUJPOܕͷίϯϏωʔγϣϯ w ߴΧΠϯυܕ 4DBMBͷجຊ ʢׂͱ୶ʑͱਐΊΔύʔτʣ 4DBMBͬΆ͞ͷ঺հ ʢϝΠϯίϯςϯπʣ
  31. ߴΧΠϯυܕʜͷલʹ 4DBMBʹ͸৭ʑͳܕ͕͋Γ·͢ΑͶʢ౜ಥʣ *OU 4USJOH .Z$MBTT

  32. 0QUJPO<">ͱ͔4FR<">ͱ͔͋Γ·͢ΑͶ *OU 4USJOH .Z$MBTT 0QUJPO<"> 4FR<"> 'VUVSF<"> ฒߦॲཧͷͨΊͷܕ 4VDDFTTͱ'BJMVSF͕͋Δ

  33. 0QUJPO<">ͱ͔4FR<">ͱ͔͋Γ·͢ΑͶ *OU 4USJ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 0QUJPO 4FR 'VUVSFΛ·ͱΊΔ֓೦͕ ͭ͘Εͨ ͜ΕΒΛ)JHIFS,JOEͷΠϯελϯεͱͯ͠ ఆٛͰ͖ͨ ͜Ε͕ϑΝϯΫλʔɺϞφυͳͲͷ֓೦ʹͭͳ͕͍ͬͯͨΓ͠·͢ Ͱɺ͜Ε͸ͳʹʁͳΜͷ໾ʹཱͭͷΑʁ͸·ͨผͷػձʹͰ΋ʜ

  38. ·ͱΊ w 4DBMBΛͬ͘͟Γͭ·Έ͙͍ͯ͠Έ·ͨ͠ w ·ͩ·ͩղઆͰ͖͍ͯͳ͍ػೳ΍֓೦͕ͨ͘͞Μ͋Γ·͢ w .BQ΍4FRͷΠϯελϯεΛؔ਺ͱͯ͠࢖͏ w ܕΫϥε w

    JNQMJDJUDMBTTʹΑΔطଘͷܕͷ֦ு w FUDʜ w 4DBMBॻָ͍͍͍ͯͯ͠৭ʑֶ΂ΔݴޠͳͷͰੋඇࢼͯ͠Έ͍ͯͩ͘͞ʂ