The problem with the original `case-lambda` tests is that they could actually pass if the `+` and `*` procedures were implemented correctly but `case-lambda` itself wasn’t. Specifically, an attempted optimized `case-lambda` implementation which looked at the length of its arguments list and subsequently erroneously always chose the variadic clause of the `plus` procedure would still pass the test, because `plus` in this case recreated the behaviour of the `+` procedure used for the test; it was never actually observable whether the `args` clause or one of the more specific clauses had been used to generate the result. Similar applies to the `mult` test: although in that case an implementation could only have erroneously chosen the `(x y . z)` clause in the two-argument case, it would still have been an error invisible to the test cases. I’ve also added a test which attempts to ensure that a redundant clause will never match. This may cause a warning on Schemes which detect such clauses at compile time, but R7RS does not explicitly define such `case-lambda` expressions as erroneous in any way, so it would be wrong (and non-conformant) for it to stop the tests running altogether. (This patch mainly useful because Chibi’s R7RS tests are sometimes used by other implementations to ensure conformance. Chibi passed these tests in any case.) |
||
---|---|---|
.githooks | ||
.github/workflows | ||
benchmarks | ||
build-lib/chibi/char-set | ||
contrib | ||
data | ||
doc | ||
examples | ||
include/chibi | ||
js | ||
lib | ||
opt | ||
tests | ||
tools | ||
.gitignore | ||
.hgignore | ||
.travis.yml | ||
appveyor.yml | ||
AUTHORS | ||
bignum.c | ||
chibi-scheme.pc.in | ||
CMakeLists.txt | ||
configure | ||
CONTRIBUTING.md | ||
COPYING | ||
eval.c | ||
fedora.spec | ||
gc.c | ||
gc_heap.c | ||
main.c | ||
Makefile | ||
Makefile.detect | ||
Makefile.libs | ||
mkfile | ||
opcodes.c | ||
plan9.c | ||
README-win32.md | ||
README.libs | ||
README.md | ||
RELEASE | ||
sexp.c | ||
simplify.c | ||
TODO | ||
VERSION | ||
vm.c |
Minimal Scheme Implementation for use as an Extension Language
http://synthcode.com/wiki/chibi-scheme
Chibi-Scheme is a very small library intended for use as an extension and scripting language in C programs. In addition to support for lightweight VM-based threads, each VM itself runs in an isolated heap allowing multiple VMs to run simultaneously in different OS threads.
There are no external dependencies so is relatively easy to drop into any project.
Despite the small size, Chibi-Scheme attempts to do The Right Thing. The default settings include:
- a full numeric tower, with rational and complex numbers
- full and seamless Unicode support
- low-level and high-level hygienic macros
- an extensible module system
Specifically, the default repl language contains all bindings from
R7RS small, available explicitly as the
(scheme small)
library. The language is built in layers, however -
see the manual for instructions on compiling with fewer features or
requesting a smaller language on startup.
Chibi-Scheme is known to work on 32 and 64-bit Linux, FreeBSD, NetBSD, OpenBSD and OS X, Plan 9, Windows, iOS, Android, ARM and Emscripten. Basic support for native Windows desktop also exists. See README-win32.md for details and build instructions.
To build on most platforms just run make && make test
. This has a
few conditionals assuming GNU make. If using another make, there are
a few parameters in Makefile.detect you need to set by hand.
This will provide a shared library libchibi-scheme, as well as a sample chibi-scheme command-line repl. You can then run
sudo make install
to install the binaries and libraries. You can optionally specify a PREFIX for the installation directory:
make PREFIX=/path/to/install/
sudo make PREFIX=/path/to/install/ install
By default files are installed in /usr/local.
If you want to try out chibi-scheme without installing, be sure to set
LD_LIBRARY_PATH
so it can find the shared libraries.
To make the emscripten build run make js
(not emmake make js
).
For more detailed documentation, run make doc
and see the generated
doc/chibi.html.