anchor.diff:  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %%% ad-hoc unit testing
   
  +unit_quiet() ->
  +  [R||R<-unit(),is_tuple(R)].
  +
   unit() ->
     lists:foldr(
       fun(Str,O)->[unit(fun transform/1,Str)|O]end,[],
  -    [{"a",
  -      {{a,'_','_'},[{'_',[],[]}],[local]}}
  +    [{"a when element(1,'$_')=/=b",
  +      {{a,'_','_'},
  +       [{'_',[{'=/=',{element,1,'$_'},b}],[]}],[local]}}
  +     ,{"a:b when element(1,'$_')=/=c",
  +       {{a,b,'_'},
  +        [{'_',[{'=/=',{element,1,'$_'},c}],[]}],[local]}}
  +     ,{"a",
  +       {{a,'_','_'},[{'_',[],[]}],[local]}}
        ,{"a",
          {{a,'_','_'},[{'_',[],[]}],[local]}}
        ,{"a->stack",
  
positive.code: split_fun(Str) ->
    fun() ->
        % strip off the actions, if any
        case re:run(Str,"^(.+)->\\s*([a-z;]+)\\s*\$",[{capture,[1,2],list}]) of
          {match,[St,Action]} -> ok;
          nomatch             -> St=Str,Action=""
        end,
        % strip off the guards, if any
        case re:run(St,"^(.+[\\s)])+when\\s(.+)\$",[{capture,[1,2],list}]) of
          {match,[S,Guard]} -> ok;
          nomatch           -> S=St,Guard=""
        end,
        % add a wildcard F, if Body is just an atom (presumably a module)
        case re:run(S,"^\\s*[a-zA-Z0-9_]+\\s*\$") of
          nomatch -> Body=S;
          _       -> Body=S++":'_'"
        end,
        {Body,Guard,Action}
    end.
  
  
negative.code: -author('Mats Cronqvist').
  
  -export([transform/1]).
  -export([unit/0,unit_quiet/0]).
  
  -define(is_string(Str), (Str=="" orelse (9=<hd(Str) andalso hd(Str)=<255))).
  
  