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

Nimで5分クッキング - IoT向け言語Nimの紹介 #iotlt

Dae1d4cc4599a65a5da6e1a1f9d96f05?s=47 n0bisuke
February 27, 2018

Nimで5分クッキング - IoT向け言語Nimの紹介 #iotlt

IoT向け言語Nimの紹介です。 SIer IoTLTにて ( https://iotlt.connpass.com/event/76829/ )
Nimの書き味紹介のためにLINE BOT作ってみます。

Nim流行るといいなぁ

Nimの日本コミュニティDiscord -> https://discord.gg/PVPYV8c

Dae1d4cc4599a65a5da6e1a1f9d96f05?s=128

n0bisuke

February 27, 2018
Tweet

Transcript

  1. NimͰ5෼ΫοΩϯά #iotlt (SIer) 2018/3/27 IoT޲͚ݴޠ(ओ؍)NimͰLINE BOTΛ࡞ͬͯΈΑ͏

  2. ੁݪ ͷͼ͚͢ dotstudio, Inc. ɾWebΤϯδχΞ ɾMicrosoft MVP (Node.js) ɾLINE API

    Expert (ࠃ಺5ਓ) ɾσδλϧϋϦ΢ουେֶେֶӃ ඇৗۈߨࢣ ɾIoTLT ओ࠵ (࣍ճ3/26 vol37) nobisuke sugawara
  3. dotstudio, inc. ཧ೦ : Ϟϊͮ͘ΓΛָ͠ΉਓΛ૿΍͍ͨ͠ 2016೥૑ۀ

  4. IoT޲͚ݴޠ(ओ؍)Nimͷ঺հ ࠓ೔ͷ࿩

  5. Nimͱ͸ ඒ͋͘͠Γͳ͕Β ύϑΥʔϚϯε͕͔ͳΓߴ͘ ϝλϓϩάϥϛϯάʹ௕͚ͨ ίϯύΠϧݴޠ Ͱ͢ɻ Nimͱ͸ (ࢀߟ) ࢸߴͷݴޠɺNimΛ࢝ΊΔΤϯδχΞ΁ by

    @rigani https://qiita.com/rigani/items/6e87c7cee6903ed65ed2
  6. https://nim-lang.org/

  7. ͷͼ͚͕͢ࢥ͏IoT޲͚ݴޠ => σόΠεͱWeb։ൃ྆ํ͕Մೳɺ଎౓͕ग़ͯॻ͖΍͍͢ IoT޲͚ݴޠͷ޲͖ෆ޲͖(ओ؍) ݴޠ Web։ൃ σόΠε։ൃ ଎౓ ॻ͖қ͞ JavaScript

    ˕ ̋ ˚ ˕ Python ˕ ̋ ˚ ˕ C++ ˚ ˕ ˕ × Go ˕ × ˕ ̋ Rust ˚ ˚ ˕ ˚ Nim ̋ ˚ ˕ ˕ ※֤ք۾ͰౖΒΕͦ͏ͳͷͰౖΒΕͨΒमਖ਼[wip]
  8. JS΍PythonͰ࢝ΊΒΕΔ͚Ͳ݁ہ଎౓΍ϥΠϒϥϦͷ༗ແͰC++ʹ ߦ͖ண͚͘ͲɺC++Λॻ͘ͷ͸ਏ͍ IoT޲͚ݴޠͷ޲͖ෆ޲͖(ओ؍) ݴޠ Web։ൃ σόΠε։ൃ ଎౓ ॻ͖қ͞ JavaScript ˕

    ̋ ˚ ˕ Python ˕ ̋ ˚ ˕ C++ ˚ ˕ ˕ × Go ˕ × ˕ ̋ Rust ˚ ˚ ˕ ˚ Nim ̋ ˚ ˕ ˕ ※֤ք۾ͰౖΒΕͦ͏ͳͷͰౖΒΕͨΒमਖ਼[wip]
  9. Alt C++తͳϙδγϣϯͰRust͕ग़ͯདྷ͚ͨͲɺRustͷॻ͖ํ͸ ݸਓతʹ͸ཧղ͕ͳ͔ͳ͔௥͍͔ͭͳ͍(ಛʹॴ༗ݖपΓ͕೉͍͠ͳͱײͨ͡) IoT޲͚ݴޠͷ޲͖ෆ޲͖(ओ؍) ݴޠ Web։ൃ σόΠε։ൃ ଎౓ ॻ͖қ͞ JavaScript

    ˕ ̋ ˚ ˕ Python ˕ ̋ ˚ ˕ C++ ˚ ˕ ˕ × Go ˕ × ˕ ̋ Rust ˚ ˚ ˕ ˚ Nim ̋ ˚ ˕ ˕ ※֤ք۾ͰౖΒΕͦ͏ͳͷͰౖΒΕͨΒमਖ਼[wip]
  10. C΍C++ͱಉ౳͘Β͍ͷ଎౓Λ୲อͭͭ͠ɺॻ͖ຯ΋PythonϥΠΫͰ (εΫϦϓτݴޠग़਎ͷਓʹ͸ಛʹ)ཧղ͠΍͍͢ɻ IoT޲͚ݴޠͷ޲͖ෆ޲͖(ओ؍) ݴޠ Web։ൃ σόΠε։ൃ ଎౓ ॻ͖қ͞ JavaScript ˕

    ̋ ˚ ˕ Python ˕ ̋ ˚ ˕ C++ ˚ ˕ ˕ × Go ˕ × ˕ ̋ Rust ˚ ˚ ˕ ˚ Nim ̋ ˚ ˕ ˕ ※֤ք۾ͰౖΒΕͦ͏ͳͷͰౖΒΕͨΒमਖ਼[wip]
  11. ͷͼ͚͕͢ࢥ͏IoT޲͚ݴޠ(࠶ܝ) => σόΠεͱWeb։ൃ྆ํ͕Մೳɺ଎౓͕ग़ͯॻ͖΍͍͢ IoT޲͚ݴޠͷ޲͖ෆ޲͖(ओ؍) ݴޠ Web։ൃ σόΠε։ൃ ଎౓ ॻ͖қ͞ JavaScript

    ˕ ̋ ˚ ˕ Python ˕ ̋ ˚ ˕ C++ ˚ ˕ ˕ × Go ˕ × ˕ ̋ Rust ˚ ˚ ˕ ˚ Nim ̋ ˚ ˕ ˕ ※֤ք۾ͰౖΒΕͦ͏ͳͷͰౖΒΕͨΒमਖ਼[wip] ϥΠϒϥϦ΍ϓϥοτϑΥʔϜͷࠓޙ ͷ֦ॆͰ؀ڥ͸มΘΔ -> ظ଴஋෦෼ ݴޠͱͯ͠ͷࠜװ෦෼ʹྑ͞Έ
  12. ɾNim͸IoT޲͚ݴޠ - C/C++ͱ࿈ܞͰ͖ɺ଎౓΋ग़Δ - Webαʔόʔͱͯ͠΋ར༻͠΍͍͢ - ॻ͖΍͍͢(ಛʹLLܥग़਎ऀ) - ͷͼ͚͕͢஫໨͍ͯ͠Δ ͭ·Γ

  13. ͞ΒʹNim͸C/C++ͷ࿈ܞػೳ͕͋Γ·͢ɻ NimͷC/C++࿈ܞ ”Nim͸جຊతʹCΛ௨ͯ͠ίϯύΠϧ͢Δʢ͍ΘΏΔτϥϯεύΠϥʣͷ ͰɺCίϯύΠϥͷ࠷దԽͷԸܙΛड͚ΒΕΔ͚ͩͰͳ͘ɺCͷࢿ࢈ͱͷ ૬ੑ΋ͱͯ΋ྑ͍Ͱ͢ɻ” proc printf(formatstr: cstring) {.header: "<stdio.h>",

    importc: "printf", varargs.} ɾimportc - cݴޠͷؔ਺ΛNimʹΠϯϙʔτ # file: fib.nim proc fib(a: cint): cint {.exportc.} = if a <= 2: result = 1 else: result = fib(a - 1) + fib(a - 2) ɾexportc - NimͷίʔυΛcݴޠ͔Βݺͼग़͢ // file: export_test.c #include "fib.h" #include <stdio.h> int main() { NimMain(); printf("%d\n", fib(10)); // output: 55 } (Ҿ༻) NimͰଞͷݴޠͱͷ࿈ܞํ๏·ͱΊ by @snowlt23 https://qiita.com/snowlt23/items/1696687cca61bfedb1cc
  14. ͭ·ΓArduinoͱ࿈ܞͰ͖Δ…? (׆ൃͰ͸ͳͦ͞͏……׆ൃʹͳͬͯ΄͍͠)

  15. ؾʹͳΔϕϯνϚʔΫ (஫:2015೥1݄࣌఺) (Ҿ༻) ͜ͷࠒ ྲྀߦΓͷ ݴޠͨͪʢଞʣͰϕϯνϚʔΫ ʢDart, Go, Julia, Nim,

    Python, Rust ଞʣ by Blank File http://h-miyako.hatenablog.com/entry/2015/01/23/060000
  16. NimݴޠͰLINE BOT։ൃʹνϟϨϯδ खܰ͞Λ࣮ײͯ͠΋Β͓͏

  17. None
  18. ࠷ۙNim͕ΩςΔΒ͍͠ͷͰɺ LINE BotͰࢼͯ͠Έͨ by @enta0701 ࢀߟ https://qiita.com/enta0701/items/ead034f13fa7cf7a1fe9 ͜ΕಡΊ͹ͨͿΜ୭Ͱ΋࡞Ε·͢ɻ

  19. ͷͼ͚͢ͷNimྺ 30෼ఔ౓ (൒ଂ໳Ӻۙ͘υτʔϧͰ18:30ࠒʹ৮Γ͸͡Ί·ͨ͠) ͔͠΋

  20. ೔ຊޠ৘ใͷௐ΂ํ - NimͷDiscord × URL͸ #iotlt πΠʔτͰ!

  21. ೔ຊޠ৘ใͷௐ΂ํ - NimͷDiscord ࣭໰ͯ͠1෼Ͱճ౴͕……!

  22. ೔ຊޠ৘ใͷௐ΂ํ - NimͷDiscord ·ͩ4ਓʂ ࠓ೔(2018/2/27)ͷ15:00ࠒʹ্ཱ͕ͪͬͨ

  23. ɾNim͕࠷ۙΩς͍ΔΒ͍͠ ɾIoTքͰ͸ಛʹ஫໨ͳͷͰ͸ ɾNim৮ͬͯΈΑ͏ ·ͱΊ