4 REM allocate the data hashmap
8 REM set the outer and data pointer
9 T
=13:L
=R
:N
=O
:GOSUB ALLOC
10 AY
=ET
:GOSUB RELEASE
: REM environment takes ownership
13 REM see RELEASE types.in.bas for environment cleanup
15 REM ENV_NEW_BINDS(O, BI, EX) -> R
21 IF Z
%(BI
,1)=0 THEN R
=E
:RETURN
22 REM get/deref the key from BI
26 IF S
$(Z%(K,1))="&" THEN GOTO EVAL_NEW_BINDS_VARGS
29 REM get/deref the key from EX
32 REM set the binding in the environment data
34 REM go to next element of BI and EX
37 GOTO ENV_NEW_BINDS_LOOP
40 REM get/deref the key from next element of BI
44 REM the value is the remaining list in EX
45 A
=EX
:T
=6:GOSUB FORCE_SEQ_TYPE
47 REM set the binding in the environment data
50 AY
=V
:GOSUB RELEASE
: REM list is owned by environment
53 REM ENV_SET(E, K, V) -> R
61 REM ENV_SET_S(E, K$, V) -> R
69 REM ENV_FIND(E, K) -> R
70 REM Returns environment (R) containing K. If found, value found is
76 REM More efficient to use GET for value (R) and contains? (T3)
78 REM if we found it, save value in T4 for ENV_GET
79 IF T3
=1 THEN T4
=R
:GOTO ENV_FIND_DONE
80 EF
=Z
%(EF
+1,1): REM get outer environment
81 IF EF
<>-1 THEN GOTO ENV_FIND_LOOP
86 REM ENV_GET(E, K) -> R
89 IF R
=-1 THEN R
=0:ER
=-1:ER
$="'"+S$(Z%(K,1))+"' not found
":GOTO ENV_GET_RETURN