anchor.diff:        From ! {self(), ok},
         {A, B} = lists:split(Cursor, Lines),
         fileed(A ++ [Line] ++ B, Cursor + 1);
  -    {From, {pop, _}} ->
  +    {From, {delete, _}} ->
         From ! {self(), ok},
  -      fileed(lists:sublist(Lines, length(Lines)-1), Cursor);
  +      {A, [_|B]} = lists:split(Cursor-1, Lines),
  +      fileed(A ++ B, Cursor);
       {From, {list, _}} ->
         From ! {self(), Lines},
         fileed(Lines, Cursor);
  
positive.code: start() ->
    spawn(?MODULE, fileed, [[], 0]).
  
  append(Pid, Line) ->
    Pid ! {self(), {append, Line}},
    receive
      {Pid, Msg} -> Msg
    after 3000 -> timeout
    end.
  
  append(Pid) ->
    L = io:get_line(""),
    case L of
      ".\n" -> quit;
      _ -> append(Pid, L),
           append(Pid)
    end.
  
  pop(Pid) ->
    Pid ! {self(), {pop, undef}},
    receive
      {Pid, Msg} -> Msg
    after 3000 -> timeout
    end.
  
  list(Pid) ->
    Pid ! {self(), {list, undef}},
    receive
      {Pid, Msg} -> Msg
    after 3000 -> timeout
    end.
  
  printall(Pid) -> io:format(list(Pid)).
  
  print(Pid) ->
    Pid ! {self(), {print, undef}},
    receive
      {Pid, Msg} -> io:format(Msg)
    after 3000 -> timeout
    end.
  
  lineCount(Pid) ->
    Pid ! {self(), {lineCount, undef}},
    receive
      {Pid, Msg} -> Msg
    after 3000 -> timeout
    end.
  
  test() ->
    E = start(),
  
negative.code: numValid(E, Num) ->
    (Num > 0) and (Num =< lineCount(E)).
  
  getcmd(E) ->
    L = chomp(io:get_line(prompt())),
    case L of
      "q" -> {quit, E};
      "a" -> append(E),
             getcmd(E);
      ",p" -> io:format("~s", [list(E)]),
              getcmd(E);
      "p" -> io:format("~s", [print(E)]),
             getcmd(E);
      "d" -> delete(E),
             getcmd(E);
      _ -> Num = getnum(L),
           NumValid = numValid(E, Num),
           if NumValid ->
                setLineNumber(E, Num),
                getcmd(E);
              true ->
                unknown(),
  