Lisp Interpreter
$ golisp < foo.lisp
$ go get github.com/mattn/golisp/cmd/golisp
Print random ints.
(setq time (go:import 'time))
(setq rand (go:import 'math/rand))
(.Seed rand (.UnixNano (.Now time)))
(print (.Int rand))
(setq time (go:import time))
(let ((ch (go:make-chan string 1)))
(go
(.Sleep time 1e9)
(go:chan-send ch "3")
(.Sleep time 1e9)
(go:chan-send ch "2")
(.Sleep time 1e9)
(go:chan-send ch "1")
(.Sleep time 1e9)
(go:chan-send ch "Fire!")
)
(print (car (go:chan-recv ch)))
(print (car (go:chan-recv ch)))
(print (car (go:chan-recv ch)))
(print (car (go:chan-recv ch)))
)
- macro
MIT
Yasuhiro Matsumoto (a.k.a. mattn)