From d7247f97c54f632439966da02dc723853020598f Mon Sep 17 00:00:00 2001 From: Celestino Amoroso Date: Thu, 23 Apr 2026 19:09:09 +0200 Subject: [PATCH] doc: added description of set() and unset() functions defined in the base buiiltin --- doc/Expr.adoc | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/doc/Expr.adoc b/doc/Expr.adoc index 206e257..c1f0e64 100644 --- a/doc/Expr.adoc +++ b/doc/Expr.adoc @@ -1087,6 +1087,8 @@ The "base" builtin module provides functions for type checking and type conversi .Other functions * <<_eval,eval()>> +* <<_set,set()>> +* <<_unset,unset()>> * <<_var,var()>> @@ -1318,6 +1320,32 @@ This function allows you to define variables whose names must include special ch `>>>` [blue]`var("gain%", var("$x")+1)` + [green]`13` +===== set +Syntax: + + `{4sp}set(, ) -> any` + +This function allows you to set the value of a variable whose name can include special characters. The first parameter is the name of the variable and the second parameter is the new value to assign to that variable. + +It is equivalent to the first form of the var() function, but it is more explicit about the intent of changing the value of an existing variable. + +.Examples +`>>>` [blue]`set("$x", 100)` + +[green]`100` + +`>>>` [blue]`var("$x")` + +[green]`100` + + +===== unset() +Syntax: + + `{4sp}unset() -> any` + +This function allows you to unset a variable whose name can include special characters. The parameter is the name of the variable to unset. + +.Examples +`>>>` [blue]`unset("$x")` + +[green]`nil` + +`>>>` [blue]`var("$x")` + +[red]`Eval Error: var(): unknown variable "$x"` + ==== Module "fmt" ===== print() @@ -1325,18 +1353,31 @@ This function allows you to define variables whose names must include special ch ===== println() ==== Module "import" +Module actiovation: + + ===== _import()_ -[blue]_import([grey]##)_ -- loads the multi-expression contained in the specified source and returns its value. +Syntax: + +`{4sp}import()` + +Loads the multi-expression contained in the specified source and returns its value. ===== _importAll()_ ==== Module "iterator" ===== run() +Syntax: + +`{4sp}run(, , ) -> any` + +Iterates over the specified iterator and applies the specified operator to the current value of the iterator. ==== Module "math.arith" Currently, the "math.arith" module provides two functions, add() and mul(), that perform addition and multiplication of an arbitrary number of parameters. More functions will be added in the future. +* <<_add,add()>> +* <<_mul,mul()>> + + ===== add() Syntax: + `{4sp}add(, , ...) -> any` +