anchor.diff:          ({'+'=Op, _, A, B})   -> {primop, fun erlang:Op/2, [A,B]};
           ({'-'=Op, _, A, B})   -> {primop, fun erlang:Op/2, [A,B]};
           ({'*'=Op, _, A, B})   -> {primop, fun erlang:Op/2, [A,B]};
  -        % No '/' yet because lack of floats.
  +                                                % No '/' yet because lack of floats.
           ({'%', _, A, B})      -> {primop, fun mod/2, [A,B]};
   
           ({bool, _, Boolean}) -> Boolean;
  
positive.code: %% Internals
  
  rework_tree (Tree) ->
      V = fun
          ({where, _, Exp, DimDecls, VarDecls}) ->
              TopExpr = Exp,
              Vars = [{var,Var, E}|| {var_decl,_,Var,E} <- VarDecls],
              Dims = [{dim,Dim,N} || {dim_decl,_,Dim,N} <- DimDecls],
              {where, TopExpr, Vars ++ Dims};
  
          ({'if', _, Ifs, Else}) -> unwrap_elsifs(Ifs, Else);
  
          ({'#.', _, Val}) ->
              %% On Section 6.4.4 “Querying the context” of the TL-doc-0.3.0
              %%   it explicitly states that ‘#.’ takes a dimension as input.
              {'#', {dim,Val}};
  
          ({tuple, _, Assocs}) -> {t, Assocs};
          ({tuple_element, _, Lhs, Rhs}) ->
              %% On Section 6.4.5 “Tuples” of the TL-doc-0.3.0, tuples are
              %%   defined as a ‘set of (dimension, value) pairs’.
              {{dim,Lhs}, Rhs};
  
          ({'or'=Op, _, A, B})  -> {primop, fun erlang:Op/2, [A,B]};
          ({'and'=Op, _, A, B}) -> {primop, fun erlang:Op/2, [A,B]};
  
negative.code:         ({int,_,N}) -> N;
          ({float,_,N}) -> N;
          ({id,_,Name}) -> Name
        end,
    case tvisitor:visit(V, Tree, bottom_up) of
      [{expr,_,TheWhereDim}] ->
        {ok, TheWhereDim};
      Else ->
        {ok, Else}
    end.
  
  
  unwrap_elsifs ([{if_expr,_,Cond,Then}|Rest], Else) ->
    {'if', Cond, Then, unwrap_elsifs(Rest,Else)};
  unwrap_elsifs ([], Else) ->
    Else.
  
  mod (X, Y) ->
    %% http://stackoverflow.com/a/858649/1418165
    (X rem Y + Y) rem Y.
  
  %% End of Module.
  