2017-03-27から1日間の記事一覧

2台のArduinoでSPI通信する

SPI.begin()はマスターにしか使えない。 スレーブは SPCR = (1 http://forum.arduino.cc/index.php?topic=184527.0 master #include <SPI.h> const byte btn = 12; // Master button digital I/O pin. const byte led = 13; // Master LED digital I/O pin. const b</spi.h>…

Clojureの利点

けっこういい感じ・REPL環境 インタプリタがある ・パッケージ依存解決のLeiningenがある ・LISP マクロが使える ・JVMで動く ・JITコンパイラで高速化 ・Swing GUIが使える ・Javaとの連携 ・マルチプラットフォーム ・Processingとの連携 ・Incanter(R的な…

ClojureからProcessingを使う

めちゃくちゃ面白い http://data-sorcery.org/2009/08/30/processing-intro/

ClojureでR-likeなグラフを描画する

Incanterがよい https://github.com/incanter/incanter

ANDをClojureで実装する

def AND(x1,x2): w1,w2,theta = 0.5,0.5,0.7 tmp = w1*x1+w2*x2 if tmp <= theta: return 0 else: return 1 (defn ADD [x1 x2] (let [w1 0.5 w2 0.5 theta 0.7 tmp (+ (* x1 w1) (* x2 w2))] (if (<= tmp theta) 0 1)))