mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-26 15:14:12 +00:00
improve readme more
This commit is contained in:
parent
d6ae366674
commit
2369dbeac7
10
README.md
10
README.md
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user