Chiang Mai Makerfaire

esp-lisp
An interactive IoT LISP for embedded esp8266 programming
(c) 2016 Jonas S Karlsson

Agenda



ESP8266


live


lisp
 
conclusion  


ESP8266
Single Chip Computer

~40KB RAM

512-4MB Flash

10RMB == 2USD

IoT


live
Lua
interactive
easy start


difficult for more than
one page of code


1 function = 600 bytes!

only have 20KB...

Lisp
live interactive
command line
program == data
I'll
teach
You
Lisp!
Number
42
String




"Hello World!"


Symbol






define
x
+



nil

( )


Pair



(3 . 4)
List



(3 . nil )


same as



(3)


List
(1 .



(2 .



(3 . ()


)

)

)

List



(1 2 3)

call a function



(+ 3 4)




call 2 functions




(* 2 (+ 3 4))



read/write pin 4

(in 4)

(out 4 1)


double


(define (double n)


(+ n n)


)



call it




(double 7)




if
(if (= 3 3)
"is equal"
"not equal"
)

loop

(define (loop n)
(if (< n 1) nil

(cons n
(loop (- n 1)) ) ) )

call it



>(loop 5)




(5 4 3 2 1)



Interactive

> trace on

> mem (+ 3 4)

> help   


Ctrl-T CTRL-C

Conclusion

1/2 the speed of compiled Lua
tail recursion
debug