2014-04-07 00:23:40 +04:00
|
|
|
% outer binds exprs -> env_new -> new_env
|
|
|
|
/env_new { 3 dict begin
|
|
|
|
%(in env_new\n) print
|
|
|
|
/exprs exch dup _sequential? { /data get }{ pop [ ] } ifelse def
|
|
|
|
/binds exch dup _sequential? { /data get }{ pop [ ] } ifelse def
|
|
|
|
/outer exch def
|
|
|
|
<<
|
|
|
|
/__outer__ outer
|
|
|
|
0 1 binds length 1 sub {
|
|
|
|
/idx exch def
|
|
|
|
binds idx get (&) eq { %if &
|
|
|
|
binds idx 1 add get % key
|
|
|
|
exprs idx exprs length idx sub getinterval % value
|
|
|
|
_list_from_array
|
|
|
|
exit
|
|
|
|
} if
|
|
|
|
binds idx get % key
|
|
|
|
exprs idx get % value
|
|
|
|
} for
|
|
|
|
>>
|
|
|
|
end } def
|
|
|
|
|
2022-01-10 02:15:40 +03:00
|
|
|
/env_set { % env key value ->
|
|
|
|
put
|
2014-04-15 07:46:54 +04:00
|
|
|
} def
|
2014-04-07 00:23:40 +04:00
|
|
|
|
2022-01-10 02:15:40 +03:00
|
|
|
/env_get { % env key -> value true OR false
|
|
|
|
{
|
|
|
|
2 copy known { get true exit } if
|
|
|
|
exch /__outer__ get
|
|
|
|
dup null eq { pop pop false exit } if
|
|
|
|
exch
|
|
|
|
} loop
|
2014-04-15 07:46:54 +04:00
|
|
|
} def
|