<?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(BasicList,Function) -- select elements from a list</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__Basic__List_cm__Function_rp.html">next</a> | <a href="_positions_lp__Visible__List_cm__Function_rp.html">previous</a> | <a href="_select_lp__Z__Z_cm__Basic__List_cm__Function_rp.html">forward</a> | <a href="_positions_lp__Visible__List_cm__Function_rp.html">backward</a> | <a href="_lists_spand_spsequences.html">up</a> | <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> <div><a href="index.html" title="">Macaulay2Doc</a> > <a href="___The_sp__Macaulay2_splanguage.html" title="">The Macaulay2 language</a> > <a href="_lists_spand_spsequences.html" title="">lists and sequences</a> > <a href="_select_lp__Basic__List_cm__Function_rp.html" title="select elements from a list">select(BasicList,Function)</a></div> <hr/> <div><h1>select(BasicList,Function) -- select elements from a list</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="___Basic__List.html">basic list</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="___Basic__List.html">basic list</a></span>, a list of those elements of the list <tt>v</tt> that yield <tt>true</tt> when the function <tt>f</tt> is applied</span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div>The order of the elements in the result will be the same as in the original list <tt>v</tt>, and the class of the result will be the same as the class of <tt>v</tt>.<table class="examples"><tr><td><pre>i1 : select({1,2,3,4,5}, odd) o1 = {1, 3, 5} o1 : List</pre> </td></tr> <tr><td><pre>i2 : select([1,2,3,4,5], odd) o2 = [1, 3, 5] o2 : Array</pre> </td></tr> </table> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_select_lp__Z__Z_cm__Basic__List_cm__Function_rp.html" title="select a limited number of elements from a list">select(ZZ,BasicList,Function)</a> -- select a limited number of elements from a list</span></li> <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> <li><span><a href="_positions_lp__Visible__List_cm__Function_rp.html" title="which elements of a list satisfy a condition">positions</a> -- which elements of a list satisfy a condition</span></li> </ul> </div> </div> </body> </html>