mirror of https://github.com/rusefi/bldc.git
Squashed 'lispBM/lispBM/' changes from cf60058d..3bb13f0f
3bb13f0f update lbmref. Added info on set! git-subtree-dir: lispBM/lispBM git-subtree-split: 3bb13f0fe3661326054122f3e4390b422d2df036
This commit is contained in:
parent
39e34bdd05
commit
3ee22f5a3c
143
doc/lbmref.md
143
doc/lbmref.md
|
@ -1,112 +1,5 @@
|
|||
# LispBM language reference
|
||||
|
||||
* [LispBM language reference](#lispbm-language-reference)
|
||||
* [Arithmetic](#arithmetic)
|
||||
* [-](#-)
|
||||
* [*](#-1)
|
||||
* [/](#-2)
|
||||
* [mod](#mod)
|
||||
* [Comparisons](#comparisons)
|
||||
* [eq](#eq)
|
||||
* [=](#-3)
|
||||
* [>](#-4)
|
||||
* [<](#-5)
|
||||
* [Boolean operators](#boolean-operators)
|
||||
* [and](#and)
|
||||
* [or](#or)
|
||||
* [not](#not)
|
||||
* [Bit level operations](#bit-level-operations)
|
||||
* [shl](#shl)
|
||||
* [shr](#shr)
|
||||
* [bitwise-and](#bitwise-and)
|
||||
* [bitwise-or](#bitwise-or)
|
||||
* [bitwise-xor](#bitwise-xor)
|
||||
* [bitwise-not](#bitwise-not)
|
||||
* [Low level operations](#low-level-operations)
|
||||
* [encode-i32](#encode-i32)
|
||||
* [encode-u32](#encode-u32)
|
||||
* [encode-float](#encode-float)
|
||||
* [decode](#decode)
|
||||
* [nil and t](#nil-and-t)
|
||||
* [nil](#nil)
|
||||
* [t](#t)
|
||||
* [Quotes and Quasiquotation](#quotes-and-quasiquotation)
|
||||
* [quote](#quote)
|
||||
* [`](#-6)
|
||||
* [,](#-7)
|
||||
* [,@](#-8)
|
||||
* [Built-in operations](#built-in-operations)
|
||||
* [eval](#eval)
|
||||
* [eval-program](#eval-program)
|
||||
* [type-of](#type-of)
|
||||
* [sym-to-str](#sym-to-str)
|
||||
* [str-to-sym](#str-to-sym)
|
||||
* [sym-to-u](#sym-to-u)
|
||||
* [u-to-sym](#u-to-sym)
|
||||
* [is-fundamental](#is-fundamental)
|
||||
* [Special forms](#special-forms)
|
||||
* [if](#if)
|
||||
* [lambda](#lambda)
|
||||
* [closure](#closure)
|
||||
* [let](#let)
|
||||
* [define](#define)
|
||||
* [progn](#progn)
|
||||
* [read](#read)
|
||||
* [read-program](#read-program)
|
||||
* [Lists and cons cells](#lists-and-cons-cells)
|
||||
* [car](#car)
|
||||
* [cdr](#cdr)
|
||||
* [cons](#cons)
|
||||
* [.](#-9)
|
||||
* [list](#list)
|
||||
* [append](#append)
|
||||
* [ix](#ix)
|
||||
* [set-car](#set-car)
|
||||
* [set-cdr](#set-cdr)
|
||||
* [Arrays](#arrays)
|
||||
* [array-read](#array-read)
|
||||
* [array-write](#array-write)
|
||||
* [Pattern-matching](#pattern-matching)
|
||||
* [match](#match)
|
||||
* [_](#_)
|
||||
* [?](#-10)
|
||||
* [?i28](#i28)
|
||||
* [?u28](#u28)
|
||||
* [?float](#float)
|
||||
* [Concurrency](#concurrency)
|
||||
* [spawn](#spawn)
|
||||
* [wait](#wait)
|
||||
* [yield](#yield)
|
||||
* [Message-passing](#message-passing)
|
||||
* [send](#send)
|
||||
* [recv](#recv)
|
||||
* [Macros](#macros)
|
||||
* [macro](#macro)
|
||||
* [Call With Current Continuation](#call-with-current-continuation)
|
||||
* [Unparsable symbols](#unparsable-symbols)
|
||||
* [no_match](#no_match)
|
||||
* [read_error](#read_error)
|
||||
* [type_error](#type_error)
|
||||
* [eval_error](#eval_error)
|
||||
* [out_of_memory](#out_of_memory)
|
||||
* [fatal_error](#fatal_error)
|
||||
* [out_of_stack](#out_of_stack)
|
||||
* [division_by_zero](#division_by_zero)
|
||||
* [variable_not_bound](#variable_not_bound)
|
||||
* [Types](#types)
|
||||
* [type-list](#type-list)
|
||||
* [type-i28](#type-i28)
|
||||
* [type-u28](#type-u28)
|
||||
* [type-float](#type-float)
|
||||
* [type-i32](#type-i32)
|
||||
* [type-u32](#type-u32)
|
||||
* [type-array](#type-array)
|
||||
* [type-symbol](#type-symbol)
|
||||
* [type-char](#type-char)
|
||||
* [type-ref](#type-ref)
|
||||
* [type-stream](#type-stream)
|
||||
|
||||
|
||||
## Arithmetic
|
||||
|
||||
### +
|
||||
|
@ -734,6 +627,42 @@ Example
|
|||
```clj
|
||||
(define apa 10)
|
||||
```
|
||||
---
|
||||
|
||||
### set!
|
||||
|
||||
The `set!` form is used to change the value of some variable in an environment.
|
||||
You can use `set!` to change the value of a global definition, a local definition
|
||||
or a variable defintion (`#var`). An application of the `set!` form looks like
|
||||
`(set! var-expr val-expr)` where `var-expr` should evaluate to a symbol. The `val-expr` is evaluated before
|
||||
rebinding the variable.
|
||||
|
||||
Examples:
|
||||
```clj
|
||||
(define a 10)
|
||||
```
|
||||
The variable `a` is now `10` in the global environment.
|
||||
```clj
|
||||
(set! 'a 20)
|
||||
```
|
||||
Now, the value of `a` will be 20. Note that `a` is quoted in the `set!` form application
|
||||
while it is not in the `define` form. This is because `define` requires the first
|
||||
argument to be a symbol while the `set!` form requires the first argument to evaluate
|
||||
into a symbol.
|
||||
|
||||
You can also set the value of a let bound variable.
|
||||
```clj
|
||||
(let ((a 10)) (set! 'a 20))
|
||||
```
|
||||
|
||||
And you can change the value of a `#var`.
|
||||
|
||||
```clj
|
||||
(define #a 10)
|
||||
|
||||
(set '#a 20)
|
||||
```
|
||||
`#a` is now 20.
|
||||
|
||||
---
|
||||
|
||||
|
|
Loading…
Reference in New Issue