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

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

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

n0bisuke

February 27, 2018
Tweet

More Decks by n0bisuke

Other Decks in Programming

Transcript

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

    Expert (ࠃ಺5ਓ) ɾσδλϧϋϦ΢ουେֶେֶӃ ඇৗۈߨࢣ ɾIoTLT ओ࠵ (࣍ճ3/26 vol37) nobisuke sugawara
  2. ͷͼ͚͕͢ࢥ͏IoT޲͚ݴޠ => σόΠεͱWeb։ൃ྆ํ͕Մೳɺ଎౓͕ग़ͯॻ͖΍͍͢ IoT޲͚ݴޠͷ޲͖ෆ޲͖(ओ؍) ݴޠ Web։ൃ σόΠε։ൃ ଎౓ ॻ͖қ͞ JavaScript

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

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

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

    ˕ ̋ ˚ ˕ Python ˕ ̋ ˚ ˕ C++ ˚ ˕ ˕ × Go ˕ × ˕ ̋ Rust ˚ ˚ ˕ ˚ Nim ̋ ˚ ˕ ˕ ※֤ք۾ͰౖΒΕͦ͏ͳͷͰౖΒΕͨΒमਖ਼[wip] ϥΠϒϥϦ΍ϓϥοτϑΥʔϜͷࠓޙ ͷ֦ॆͰ؀ڥ͸มΘΔ -> ظ଴஋෦෼ ݴޠͱͯ͠ͷࠜװ෦෼ʹྑ͞Έ
  6. ͞Βʹ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
  7. ؾʹͳΔϕϯνϚʔΫ (஫:2015೥1݄࣌఺) (Ҿ༻) ͜ͷࠒ ྲྀߦΓͷ ݴޠͨͪʢଞʣͰϕϯνϚʔΫ ʢDart, Go, Julia, Nim,

    Python, Rust ଞʣ by Blank File http://h-miyako.hatenablog.com/entry/2015/01/23/060000