Interface EvalEnv

All Known Subinterfaces:
MutableEvalEnv
All Known Implementing Classes:
EvalEnvs.ArraySubEvalEnv, EvalEnvs.MapEvalEnv, EvalEnvs.MutableArraySubEvalEnv, EvalEnvs.MutablePatSubEvalEnv, EvalEnvs.MutableSubEvalEnv, EvalEnvs.PatSubEvalEnv, EvalEnvs.SubEvalEnv

public interface EvalEnv
Evaluation environment.

Whereas Environment contains both types and values, because it is used for validation/compilation, EvalEnv contains only values.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name of the variable that contains the Session.
  • Method Summary

    Modifier and Type
    Method
    Description
    default EvalEnv
    bind(String name, Object value)
    Creates an environment that has the same content as this one, plus the binding (name, value).
    Creates an evaluation environment that has the same content as this one, plus a mutable slot.
    Creates an evaluation environment that has the same content as this one, plus a mutable slot or slots.
    Creates an evaluation environment that has the same content as this one, plus mutable slots for each name in a pattern.
    default EvalEnv
    fix()
    Converts this environment to a non-mutable environment.
    getOpt(String name)
    Returns the binding of name if bound, null if not.
    default Map<String,Object>
    Returns a map of the values and bindings.
    void
    Visits every variable binding in this environment.
  • Field Details

  • Method Details

    • getOpt

      Object getOpt(String name)
      Returns the binding of name if bound, null if not.
    • bind

      default EvalEnv bind(String name, Object value)
      Creates an environment that has the same content as this one, plus the binding (name, value).
    • bindMutable

      default MutableEvalEnv bindMutable(String name)
      Creates an evaluation environment that has the same content as this one, plus a mutable slot.
    • bindMutablePat

      default MutableEvalEnv bindMutablePat(Core.Pat pat)
      Creates an evaluation environment that has the same content as this one, plus mutable slots for each name in a pattern.
    • bindMutableArray

      default MutableEvalEnv bindMutableArray(List<String> names)
      Creates an evaluation environment that has the same content as this one, plus a mutable slot or slots.

      If names has one element, calling MutableEvalEnv.set(Object) will populate the slot will be filled by an object; if names has more than one element, set will expect to be given an array with the same number of elements.

    • visit

      void visit(BiConsumer<String,Object> consumer)
      Visits every variable binding in this environment.

      Bindings that are obscured by more recent bindings of the same name are visited, but after the more obscuring bindings.

    • valueMap

      default Map<String,Object> valueMap()
      Returns a map of the values and bindings.
    • fix

      default EvalEnv fix()
      Converts this environment to a non-mutable environment.