envsel.sl 932 B

1234567891011121314151617181920212223242526272829303132
  1. %
  2. % ENVSEL.SL - Utilities for switching between "environments".
  3. %
  4. % Author: William F. Galway
  5. % Symbolic Computation Group
  6. % Computer Science Dept.
  7. % University of Utah
  8. % Date: 8 June 1982
  9. % Copyright (c) 1982 University of Utah
  10. %
  11. % Utilities for switching between environments in EMODE. Both buffers and
  12. % windows are examples of environments. Currently an environment is just
  13. % an association list of (name . value)'s.
  14. % Store variable bindings in association list.
  15. (DE SaveEnv (env)
  16. (progn
  17. (for (in binding-pair env)
  18. % Replace the cdr with the value of the car.
  19. (do
  20. (RPLACD binding-pair (eval (car binding-pair)))))
  21. % Return the updated environment.
  22. env))
  23. % Establish ("restore") the bindings stored in association list "env"
  24. (DE RestoreEnv (env)
  25. (for (in binding-pair env)
  26. (do
  27. (set (car binding-pair) (cdr binding-pair)))))