improve readme more

This commit is contained in:
Pekka Laiho 2020-12-05 18:09:26 +07:00
parent d6ae366674
commit 2369dbeac7

View File

@ -143,13 +143,15 @@ Use the `quasiquote` special form when you need to turn on evaluation temporaril
You can use the single-quote (`'`), backtick and tilde (`~`) characters as shortcuts for `quote`, `quasiquote` and `unquote` respectively: You can use the single-quote (`'`), backtick and tilde (`~`) characters as shortcuts for `quote`, `quasiquote` and `unquote` respectively:
``` ```
> '(1 2 3) > '(a b c)
(1 2 3) (a b c)
> `(5 ~(+ 2 4) 7) > `(a ~(+ 1 2) c)
(5 6 7) (a 3 c)
``` ```
All special forms related to quoting require exactly one argument.
## Environments ## Environments
Environments are hash-maps which store key-value pairs and use symbols as keys. Symbols are evaluated by looking up the corresponding value from the current environment. If the key is not defined in current environment the lookup proceeds to the parent environment and so forth. The initial environment is called `root` and contains all the built-in functions listed here. Then another environment called `user` is created for anything the user wants to define. The `let` and `fn` special forms create new local environments. Note that `def` always uses the current environment, so anything defined with `def` is not visible in the parent environment. Environments are hash-maps which store key-value pairs and use symbols as keys. Symbols are evaluated by looking up the corresponding value from the current environment. If the key is not defined in current environment the lookup proceeds to the parent environment and so forth. The initial environment is called `root` and contains all the built-in functions listed here. Then another environment called `user` is created for anything the user wants to define. The `let` and `fn` special forms create new local environments. Note that `def` always uses the current environment, so anything defined with `def` is not visible in the parent environment.