anchor.diff:      end;
   map_put(NK,NV, emptymap) -> {map, {NK, NV}, emptymap, emptymap, 1}.
   
  -
  -
   map_rotate({map, KV, L, R, _}) ->
       LD = map_depth(L),
       RD = map_depth(R),
  
positive.code:             if
                  LLD > LRD -> % 左の木の左が深いなら左の木を上げる
                      NR = map_rotate({map, KV, LR, R, 0}),
                      {map, KVL, LL, NR, max([LLD|[map_depth(NR)]]) + 1};
                  true -> % 左の木の右が深いなら左の木の右を上げる
                      {_, KVLR, LRL, LRR, _} = LR,
                      NR = map_rotate({map, KV, LRR, R, 0}),
                      NL = map_rotate({map, KVL, LL, LRL, 0}),
                      {map, KVLR, NL, NR, max([map_depth(NL)|[map_depth(NR)]]) + 1}
              end;
          X when X < -1 -> % 右の木が深過ぎ
              {_, KVR, RL, RR, _} = R,
  
negative.code:                     {_, KVRL, RLL, RLR, _} = RL,
                      NR = map_rotate({map, KVR, RLR, RR, 0}),
                      NL = map_rotate({map, KV, L, RLL, 0}),
                      map_rotate({map, KVRL, NL, NR, 0});
                  true -> % 右の木の右が深いなら右の木を上げる
                      NL = map_rotate({map, KV, L, RL, 0}),
                      map_rotate({map, KVR, NL, RR, 0})
              end;
          _Else ->
              {map, KV, L, R, max([LD|[RD]]) + 1}
      end.
  
  map_depth({map, _, _, _, D}) -> D;
  