about summary refs log tree commit diff stats

Chicanery: subtle, opinionated improvements to R7RS Scheme for CHICKEN

While I was reading the R7RS specification, I was a little annoyed by how broken up the standard library seemed to be. While the most egregious example is maybe (scheme case-lambda), which exports … only case-lambda, the other libraries like (scheme write) for display, (scheme cxr) for functions like caddr but not cddr, and the rest didn’t really seem logical to me. Plus, in CHICKEN scheme, the one I usually use, utf8 is an egg you need to install separately…

To ameliorate these minor warts in what I otherwise consider to be an excellent language, chicanery was born. It’s kind of like a prelude, I suppose? It imports all r7rs modules and re-exports their identifiers, and makes sure the implementation is Unicode-aware.

Chicanery extras

The following are included in the chicanery library because I like them.

  • (atom? x) determines whether x is an atom (i.e., not a pair or null)
  • (slurp [port]) reads a port until hitting end-of-file (IDK why this isn’t in R7RS!)
  • (with-input-from-string str thunk) calls thunk with str bound as the current-input-port.
  • (with-output-to-string thunk) calls thunk and returns a string of the output.
  • (displayed x), (->string x) returns x as a string (via display)
  • (written x) returns x as a string (via write)
  • (print . xs) displays xs followed by a newline

Todo

  • Support multiple scheme implementations. I tried doing this (see the multiple-impls branch), but it kept not working in weird ways, plus it was like whack-a-mole with all the different schemes and just exhausting.

License

This software is licensed under the GWL, v 1.0. See COPYING for details.