Evaluator Functions¶
- function evaluate/evaluate src [args]¶
evaluate Idio source code src in the context of evaluation environment eenv and return intermediate code for the code generator
- Param src:
Idio source code
- Type src:
Abstract Syntax Tree
- Param eenv:
evaluation environment, defaults to a new instance
- Type eenv:
struct-instance, optional
- function symbol-value sym mod [default]¶
Return the value of sym in mod or default if supplied
- Param sym:
symbol to query
- Type sym:
symbol
- Param mod:
module to query
- Type mod:
module or name
- Param default:
(optional) value to return if sym is not defined in mod
- Type defined:
any
- Return:
value or default
- template cond-expand clauses¶
cond-expandreduces clauses to the firstcond_expand_clausewhere the clause’sfeature_requirementis truecond-expandis a template and so, in effect, it reduces the set of clauses supplied to just the first that is true.The
feature_requirementfor each clause in clauses is constructed from the presence offeature_identifiers or logical combinations of those features. The features themselves are set by idio or can be augmented by users.The clauses for
cond-expandare interpreted as the (SRFI-0) grammarconditional_expansion_form:conditional_expansion_form ::= (cond-expand
cond_expand_clause+) | (cond-expandcond_expand_clause* (else expression*)) cond_expand_clause ::= (feature_requirementexpression*) feature_requirement ::=feature_identifier| (andfeature_requirement*) | (orfeature_requirement*) | (notfeature_requirement) feature_identifier ::= a symbol or string, see below- Example:
Several tests of standard library calls in libc differ between operating systems. We can specialize as appropriate and
cond-expandresults in just a singlelibc-wrap-error-loadexpression in the byte code.(cond-expand ((or "uname/sysname/FreeBSD" "uname/sysname/OpenBSD" "uname/sysname/Darwin") { libc-wrap-error-load "libc-wrap-errors/EGID-set-invalid-gid.idio" "Operation not permitted" EPERM "setegid" }) (else { libc-wrap-error-load "libc-wrap-errors/EGID-set-invalid-gid.idio" "Invalid argument" EINVAL "setegid" }) )
See also
- function %add-feature f¶
add feature f to Idio features
- Param f:
feature to add
- Type f:
symbol or string
- Return:
new list of features
Last built at 2025-10-29T07:10:37Z+0000 from 3d9f9d3 (dev) for Idio 0.3.b.6