Executes a job within its own environment (as specified by symbol-value
pairs in lst
). The current values of all symbols are saved, the
symbols are bound to the values in lst
, prg
is
executed, then the (possibly modified) symbol values are (destructively) stored
in the environment list, and the symbols are restored to their original values.
The return value is the result of prg
. Typically used in curried
functions and *Run
tasks. See also env
, bind
, let
, use
and state
.
: (de tst ()
(job '((A . 0) (B . 0))
(println (inc 'A) (inc 'B 2)) ) )
-> tst
: (tst)
1 2
-> 2
: (tst)
2 4
-> 4
: (tst)
3 6
-> 6
: (pp 'tst)
(de tst NIL
(job '((A . 3) (B . 6))
(println (inc 'A) (inc 'B 2)) ) )
-> tst