golisp
Lisp Interpreter
Usage
$ golisp < foo.lisp
Installation
$ go get github.com/mattn/golisp/cmd/golisp
Features
Call Go functions.
Print random ints.
(setq time (go:import 'time))
(setq rand (go:import 'math/rand))
(.Seed rand (.UnixNano (.Now time)))
(print (.Int rand))
Use goroutine/channel
(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)))
)
TODO
- macro
License
MIT
Author
Yasuhiro Matsumoto (a.k.a. mattn)