4 ms·
No, all numbers are represented by double precision floating point numbers (float64 in Go). The previous version (http://www.oki-osk.jp/esc/golang/lisp3.html h
by suzuki 11y ago
No, all numbers are represented by double precision floating point numbers (float64 in Go).
The previous version (http://www.oki-osk.jp/esc/golang/lisp3.html http://www.oki-osk.jp/esc/golang/lisp3.html in Japanese) used Go's standard library "math/big" to represent big integers. However, the interpreter was also big and organized into several packages. I revised the interpreter smaller so that
1. it can be compiled in the easiest way, and
2. it may be comparable with the interpreter written in TypeScript.
Note that TypeScript (i.e. JavaScript effectively) represents all numbers in float64.
By the way, as for numbers only, the first interpreter (http://www.oki-osk.jp/esc/golang/lisp.html http://www.oki-osk.jp/esc/golang/lisp.html in Japanese) was the most powerful. It implemented mixed mode arithmetic including arbitrary-precision rational numbers with the "arith" package (http://www.oki-osk.jp/esc/golang/arith.html http://www.oki-osk.jp/esc/golang/arith.html in Japanese). However, the first interpreter was so tiny as a Lisp that it had no macros, while it was organized into several files.