implement suggestion #199

Tentative pull. functional, with doc and test.
It looks to me like you put that line in there so that if "continue" is
executed in the body of the function
handling the collisions, then the result would be a hash table in which the
key doesn't appear.  This could be used,
for example, if we are allowing hash tables to represent tallies where the
values are integers, but the value 0, denoting
absence, when encountered, results in absence.

On Thu Dec 04 2014 at 9:55:04 PM Paul Zinn-Justin <notifications@github.com>
wrote:

> In M2/Macaulay2/d/evaluate.d:
>
> > +export mapkeysmerge(f:Expr,o:HashTable,g:Expr):Expr := (
> > +     x := newHashTable(o.Class,o.parent);
> > +     x.beingInitialized = true;
> > +     foreach bucket in o.table do (
> > +	  p := bucket;
> > +	  while true do (
> > +	       if p == p.next then break;
> > +	       newkey := applyEE(f,p.key);
> > +	       if newkey == nullE then return buildErrorPacket("null key encountered"); -- remove soon!!!
> > +	       when newkey is Error do return newkey else nothing;
> > +	       h := hash(newkey);
> > +	       val := lookup1(x,newkey,h);
> > +	       if val != notfoundE then (
> > +	       	  t := applyEEE(g,val,p.value);
> > +		  when t is err:Error do (
> > +			      	   if err.message != continueMessage then return t else remove(x,newkey);
>
> I think I got everything covered except the last one. perhaps I'll let you
> explain that "continue" statement?
> … <#msg-f:1486620411913715861_>
> On Fri, Dec 5, 2014 at 1:57 AM, Daniel R. Grayson <
> notifications@github.com> wrote: In M2/Macaulay2/d/evaluate.d: > +export
> mapkeysmerge(f:Expr,o:HashTable,g:Expr):Expr := ( > + x :=
> newHashTable(o.Class,o.parent); > + x.beingInitialized = true; > + foreach
> bucket in o.table do ( > + p := bucket; > + while true do ( > + if p ==
> p.next then break; > + newkey := applyEE(f,p.key); > + if newkey == nullE
> then return buildErrorPacket("null key encountered"); -- remove soon!!! > +
> when newkey is Error do return newkey else nothing; > + h := hash(newkey);
> > + val := lookup1(x,newkey,h); > + if val != notfoundE then ( > + t :=
> applyEEE(g,val,p.value); > + when t is err:Error do ( > + if err.message !=
> continueMessage then return t else remove(x,newkey); Let's document the
> effect of "continue" here. — Reply to this email directly or view it on
> GitHub <https://github.com/Macaulay2/M2/pull/200/files#r21348903>.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/Macaulay2/M2/pull/200/files#r21354285>.
>