/ ideas / term-search-eval
term-search-eval
 1  Idea: language that evaluates expressions by first searching for if the
 2  expression is already bound to a value (registered), and if not then does Kernel
 3  combiner evaluation.
 4  
 5  To make such term searching more efficient, a tree could be used for the
 6  environment such that matching a term is following the matching path down
 7  the tree branches, and if a complete path-match exists all the way then the term
 8  is bound and its value is there, or else the term is not bound and all other
 9  terms in the env are eliminated and don't need to be tested.
10  
11        --symbols
12       /
13  env--                               --#[id sym=foo env=...]--cdr--
14       \                             /
15        --pairs--         --symbols--
16                 \       /
17                  --car--
18                         \
19                          --pairs
20                        
21  
22  However, extending such an environment tree with a new binding would be less
23  efficient than simple stack pushing.  At least functional updating of trees can
24  reuse unmodified branches (i.e. share structure).  Also, binders/vau can extend
25  envs by a stack of trees, similar to common impl chaining parent envs.  This
26  would increase the efficiency of extending envs but decrease efficiency of
27  searching for terms (because chain of parents must be exhausted before deciding
28  a term is unbound).
29  
30  So the advantage of such tree envs is for large envs having many complex terms.