<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>mergePairs -- merge sorted lists of pairs</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="___Method__Function.html">next</a> | <a href="_memoize.html">previous</a> | <a href="___Method__Function.html">forward</a> | <a href="_memoize.html">backward</a> | up | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <hr/> <div><h1>mergePairs -- merge sorted lists of pairs</h1> <div class="single"><h2>Description</h2> <div><tt>mergePairs(x,y,f)</tt> merges sorted lists of pairs.<p/> It merges <tt>x</tt> and <tt>y</tt>, which should be lists of pairs <tt>(k,v)</tt> arranged in increasing order according to the key <tt>k</tt>. The result will be a list of pairs, also arranged in increasing order, each of which is either from <tt>x</tt> or from <tt>y</tt>, or in the case where a key <tt>k</tt> occurs in both, with say <tt>(k,v)</tt> in <tt>x</tt> and <tt>(k,w)</tt> in <tt>y</tt>, then the result will contain the pair <tt>(k,f(v,w))</tt>. Thus the function <tt>f</tt> is used for combining the values when the keys collide. The class of the result is taken to be the minimal common ancestor of the class of <tt>x</tt> and the class of <tt>y</tt>.<p/> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_merge_lp__Hash__Table_cm__Hash__Table_cm__Function_rp.html" title="merge hash tables">merge</a> -- merge hash tables</span></li> </ul> </div> <div class="waystouse"><h2>Ways to use <tt>mergePairs</tt> :</h2> <ul><li>mergePairs(BasicList,BasicList,Function)</li> </ul> </div> </div> </body> </html>