diff options
author | Case Duckworth | 2023-08-09 12:55:32 -0500 |
---|---|---|
committer | Case Duckworth | 2023-08-09 12:55:32 -0500 |
commit | 7267e4e409820200e2f0382464d4482ad0594290 (patch) | |
tree | 863860fd9876ead96cf17e24e2a94d8b49bd9b4f /README.md | |
parent | Correct definition of atom? (diff) | |
download | chicanery-7267e4e409820200e2f0382464d4482ad0594290.tar.gz chicanery-7267e4e409820200e2f0382464d4482ad0594290.zip |
Update README
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/README.md b/README.md index 1d5e86b..08a0132 100644 --- a/README.md +++ b/README.md | |||
@@ -1,14 +1,53 @@ | |||
1 | # Chicanery: subtle, opinionated improvements to R7RS in CHICKEN | 1 | # Chicanery: subtle, opinionated improvements to R7RS Scheme |
2 | 2 | ||
3 | `chicanery` is my attempt at a prelude module for CHICKEN scheme. It imports and re-exports all `r7rs` modules, using `utf8` where possible, and it corrects a few (in my mind) rough spots in the language, to whit: | 3 | While I was reading the [R7RS |
4 | specification](https://standards.scheme.org/official/r7rs.pdf), I was a little | ||
5 | annoyed by how broken up the standard library seemed to be. While the most | ||
6 | egregious example is maybe `(scheme case-lambda)`, which exports ... only | ||
7 | `case-lambda`, the other libraries like `(scheme write)` for `display`, `(scheme | ||
8 | cxr)` for functions like `caddr` but not `cddr`, and the rest didn't really seem | ||
9 | logical to me. Plus, in CHICKEN scheme, the one I usually use, `utf8` is an egg | ||
10 | you need to install separately... | ||
4 | 11 | ||
5 | - `map`, `for-each`, and `append` are now generalized over lists, vectors, strings, and bytevectors (where appropriate). The list versions of these procedures have been named `list-map`, `list-for-each`, and `list-append` respectively. | 12 | To ameliorate these minor warts in what I otherwise consider to be an excellent |
6 | - `ref` and `copy` have been defined as generalized functions over the above data types. | 13 | language, `chicanery` was born. It's kind of like a prelude, I suppose? It |
14 | imports all `r7rs` modules and re-exports their identifiers, and makes sure the | ||
15 | implementation is Unicode-aware. It also includes a few extras ;) | ||
7 | 16 | ||
8 | ## Todo | 17 | ## Chicanery extras |
9 | 18 | ||
10 | - Make sure `set!` works in, like, `(set! (ref 5 '(1 2 3 4 5)) 10)` | 19 | I also thought it was strange that `map`, `for-each`, and `append` apply to |
20 | lists only, while `vector-map` and `string-for-each`, exist, for example. | ||
21 | `chicanery` prefixes the default `map`, `for-each`, and `append` functions with | ||
22 | `list-`, and redefines those identifiers to functions that are generic over | ||
23 | Scheme's base collection types (lists, strings, vectors, bytevectors where | ||
24 | applicable). I didn't make the functions fully-generic to keep them efficient | ||
25 | and because I don't know how to do that, but you can still use `vector-append` | ||
26 | or `list-map` if you know what type you need and want speed. | ||
27 | |||
28 | In a similar vein, I've also added generic functions `ref` and `copy` that | ||
29 | dispatch to `string-ref`, `list-copy`, and the like. | ||
30 | |||
31 | Other extras include | ||
32 | |||
33 | - `(atom? x)` determines whether `x` is an atom (i.e., not a pair or null) | ||
34 | - `(read-port)`, `(read-port port)` reads a port until hitting end-of-file (IDK | ||
35 | why this isn't in R7RS!), in chunks of `read-port-chunk-size` | ||
36 | - `(defined? x)` returns whether the symbol `x` is bound to a variable | ||
37 | - `(displayed x)`, `(->string x)` returns `x` as a string (via `display`) | ||
38 | - `(written x)` returns `x` as a string (via `write`) | ||
39 | - `(print x ...)` displays `x ...` followed by a newline | ||
40 | |||
41 | ## Supported Scheme implementations | ||
42 | |||
43 | `chicanery` now supports multiple R7RS implementations! The full list can be | ||
44 | found by running `make`, but here's what we have right now: | ||
45 | |||
46 | - chicken | ||
47 | - guile | ||
48 | - gambit | ||
49 | - chibi | ||
11 | 50 | ||
12 | ## License | 51 | ## License |
13 | 52 | ||
14 | This software is licensed under the GWL, v. 1.0. See COPYING for details. | 53 | This software is licensed under the GWL, v. 1.0. See COPYING for details. |