Mercurial > lbo > hg > ylisp
changeset 143:f30fbc9202c2
doc: Minor updates about if, function calls
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Tue, 03 Sep 2019 12:14:51 +0200 |
parents | 4e0060d95d31 |
children | 105037679bf8 |
files | doc/execution.md doc/syntax.md |
diffstat | 2 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/execution.md Tue Sep 03 09:43:48 2019 +0200 +++ b/doc/execution.md Tue Sep 03 12:14:51 2019 +0200 @@ -102,10 +102,8 @@ ## Function calls -The `ypreprocess_defn()` stage only looks at `defn` expressions. For every -`defn` it encounters, it creates a new function reference (in the global values -table, see `value.h`) describing the function with its name, arguments, and -body. The body is stored as vector of expressions that can be evaluated. +`ypreprocess_refs()` extracts function definitions, stores them as values in the +value table, and replaces them with `undef` expressions. The source code contains references to the arguments by name; the `defn` preprocessing resolves all references to function arguments to "stack-refs",
--- a/doc/syntax.md Tue Sep 03 09:43:48 2019 +0200 +++ b/doc/syntax.md Tue Sep 03 12:14:51 2019 +0200 @@ -43,13 +43,16 @@ #### `if` ``` -(if cond then [else]) +(if cond (then-exprs) [(else-exprs)]) ``` Where `cond` evaluates to a boolean value (numeric 1 or 0) and `then`, `else` are expressions. If multiple expressions should be executed, `seq` can be used to chain them. +`cond` should evaluate to either `'true`/`'false` or an integer (0 is false, +everything else is true). + #### `seq` ```