
/* Assoc : given an assoc list like for example l:={{a,2},{b,3}},
   Assoc(b,l) will return {b,3}. if the key is not in the list,
   it will return the atom Empty.
*/
RuleBase("Assoc",{key,list});
Rule("Assoc",2,1,list = {}) Empty;
Rule("Assoc",2,2,list[[1]][[1]] = key) list[[1]];
Rule("Assoc",2,3,True) Assoc(key,Tail(list));

AssocIndices(associndiceslist):=
  DestructiveReverse(MapSingle("Head",associndiceslist));


