Update
This commit is contained in:
parent
3a465aea74
commit
69394ab8da
13 changed files with 1928 additions and 1822 deletions
8
lisp.md
8
lisp.md
|
@ -18,7 +18,7 @@ Lisps also have various systems of [macros](macro.md) that allow to extend the l
|
|||
|
||||
- **Common Lisp** (CL): The "big", [bloated](bloat.md) (for Lisp standards), "feature rich" kind of Lisp, around since 1984; it is widely supported and well standardized by ANSI.
|
||||
- **Scheme** (and descendants such as *Racket*): Well established minimalist branch of Lisp, around since 1975.
|
||||
- **Clojure**: Some shitty Lisp in [Java](java.md) or something.
|
||||
- **Clojure**: Some shitty Lisp in [Java](java.md) or something. It distances itself from other Lisps by dropping some essential structures such as cons cells, for which some (like [Richard Stallman](rms.md)) argue it's not even Lisp anymore.
|
||||
- **PicoLisp**: Another minimalist kind of Lisp, looks cool but probably not as famous as Scheme.
|
||||
- **Emacs Lisp**: Used in [Emacs](emacs.md) text editor.
|
||||
- ...
|
||||
|
@ -54,7 +54,7 @@ Here is a small cheatsheet:
|
|||
- **variables**: `(define varName value)` creates variable *varName* with initial value set. Similarly `(let ((v1 a) (v2 b) ...) commands)` creates a block (similar to C's `{`/`}` block) with local variables *v1*, *v2* etc. (with initial values *a*, *b* etc.). Then `(set! var value)` is used to set the variable value (`!` indicates a side effect).
|
||||
- **functions**: `(define (fName x y z) ...)` creates function *fName* with parameters *x*, *y* and *z*; `(fName a b c)` calls the function. Expressions in function are evaluated from left to right, the value of last expression is returned by the function.
|
||||
- **[input/output](io.md)**: `(read)` reads a value from input, `(display x)` prints out value *x*.
|
||||
- **other**: `sin`, `cos`, `log`, `exp`, `sqrt`, `number->string`, `string->number`, `string?`, `list?`, `character?`, `cons` (creates pair from two values), `list` (creates list from all arguments), `quote` (special form, creates a list without evaluating it), `(lambda (x y ...) commands ...)` (creates anonymous function), ...
|
||||
- **other**: `sin`, `cos`, `log`, `exp`, `sqrt`, `number->string`, `string->number`, `string-append`, `string?`, `list?`, `character?`, `cons` (creates pair from two values), `list` (creates list from all arguments), `quote` (special form, creates a list without evaluating it), `(lambda (x y ...) commands ...)` (creates anonymous function), ...
|
||||
|
||||
**Example**: here is our standardized **divisor tree** program written in Scheme:
|
||||
|
||||
|
@ -96,6 +96,4 @@ Here is a small cheatsheet:
|
|||
(mainLoop)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
TODO: the basic two-function definition of Lisp
|
Loading…
Add table
Add a link
Reference in a new issue