<?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>select(HashTable,Function) -- select part of a hash table</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_select_lp__Z__Z_cm__Hash__Table_cm__Function_rp.html">next</a> | <a href="_select.html">previous</a> | <a href="_select_lp__Z__Z_cm__Hash__Table_cm__Function_rp.html">forward</a> | <a href="_select.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>select(HashTable,Function) -- select part of a hash table</h1> <div class="single"><h2>Synopsis</h2> <ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>select(v,f)</tt></div> </dd></dl> </div> </li> <li><span>Function: <a href="_select.html" title="select from a list, hash table, or string">select</a></span></li> <li><div class="single">Inputs:<ul><li><span><tt>v</tt>, <span>a <a href="___Hash__Table.html">hash table</a></span></span></li> <li><span><tt>f</tt>, <span>a <a href="___Function.html">function</a></span>, returning either <a href="_true.html" title="">true</a> or <a href="_false.html" title="">false</a></span></li> </ul> </div> </li> <li><div class="single">Outputs:<ul><li><span><span>a <a href="___Hash__Table.html">hash table</a></span>, whose pairs are those key-value pairs <tt>(k,w)</tt> of the hash table <tt>v</tt> that yield <tt>true</tt> when the function <tt>f</tt> is applied to the value <tt>w</tt>.</span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div>The hash table <tt>v</tt> should be immutable: to scan the values in a mutable hash table, use <tt>scan(values x, f)</tt>.<table class="examples"><tr><td><pre>i1 : x = new HashTable from { x => 1, y => 2, z => 3 } o1 = HashTable{x => 1} y => 2 z => 3 o1 : HashTable</pre> </td></tr> <tr><td><pre>i2 : select(x,odd) o2 = HashTable{x => 1} z => 3 o2 : HashTable</pre> </td></tr> </table> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_partition.html" title="partition a set or list by values of a function">partition</a> -- partition a set or list by values of a function</span></li> </ul> </div> </div> </body> </html>