Skip to content

Latest commit

 

History

History
48 lines (25 loc) · 4.09 KB

README.md

File metadata and controls

48 lines (25 loc) · 4.09 KB

Z3S5 Lisp

"I want my 1980s Lisp!"

Z3S5 GoDoc Go Report Card

Usage

Check out the basic lisp interpreter z3.go in folder cmd/z3/ for an example of how to use Z3S5 Lisp in the Go language. You may also use the interpreter from the command line by running the z3 binary. There is a version with GUI support in z3g.go in folder cmd/z3g/. This integrates Fyne for building graphical user interfaces. The startup with GUI is a bit more complicated since the GUI loop runs concurrently. You can find an example in z3g.go. See the file cmd/z3g/demo.lisp for GUI demos.

There is a build tag nosound you may use to leave out sound support. If this option is not specified, then the beep command produces a few basic sounds which are embedded into the executable and do slightly increase its size.

Building

Go 1.22+ is required.

Linux: Alsa sound support development library libasound2 needs to be installed with apt get install libasound2 on Debian-based distributions. For the manuals both pandoc and the Eisvogel Pandoc Template are required. Notice that normal make will attempt to compile these manuals. You may use make lisp in directory cmd/z3 to only compile the z3 sample executable if you want to test it without generating manuals.

Windows: This has not been tested on Windows but should work as long as your machine satisfies the compilation requirements for the Beep sound library or if you use build tag nosound.

MacOS: Not tested so far; building should be similar to Linux.

Z3S5 Lisp Reference

A rudimentary user manual can be found in directory docs/usermanual and PDF and HTML can be generated using the accompanying makefile if pandoc is installed on your system. A very large reference manual can be generated by using the makefile in the main directory or make docs in directory cmd/z3 once the z3 executable has been built.

Online help: You may use (dump [prefix]) in the Lisp system to get a list of toplevel bindings, (help symbol) without quote to get information about a function, global symbol, or macro. To get a list of help topics use (help-topics) and (help-about topic) provides a list of symbols for a help topic. Notice that GUI commands are only available when Z3S5 Lisp was compiled with GUI support, as illustrated in cmd/z3g/z3g.go.

Z3S5 Lisp is an old-fashioned Lisp-1 dialect originally based on Nukata Lisp by SUZUKI Hisao. It uses real cons cells and is reasonably fast for an interpreter. (Depending on your mileage, it's definitely not optimized for speed.) There are some notable differences to other Lisps:

  • Iterators over sequences use the order (iterator sequence function), not sometimes one and sometimes the other. Exception: memq and member ask whether an element is a member of a list and have order (member element list).

  • There is no meaningful eq, equality is generally tested with equal?.

  • Predicate names generally end in a question mark like in Scheme dialects except for = for numeric equality. Example: equal?. There is no p-suffix like in other Lisps.

  • dict data structures are very powerful and multi-threading safe.

  • There is experimental support for concurrency with green threads (aka goroutines).

Please don't complain it's not Common Lisp or R7RS Scheme! Z3S5 Lisp is deliberately a somewhat arcane, old-fashioned language mostly used for experimentation in a forthcoming retro-style virtual Lisp machine and as an extension language for my own software projects.

License

Permissive MIT License. Happy hacking! 😸