<?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>any(BasicList,Function) -- whether any elements of a list satisfy a specified condition</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_position.html">next</a> | <a href="_all_lp__Basic__List_cm__Function_rp.html">previous</a> | <a href="_position.html">forward</a> | <a href="_all_lp__Basic__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="_any_lp__Basic__List_cm__Function_rp.html" title="whether any elements of a list satisfy a specified condition">any(BasicList,Function)</a></div> <hr/> <div><h1>any(BasicList,Function) -- whether any elements of a list satisfy a specified condition</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>any(L,f)</tt></div> </dd></dl> </div> </li> <li><span>Function: <a href="_any.html" title="whether any elements satisfy a specified condition">any</a></span></li> <li><div class="single">Inputs:<ul><li><span><tt>L</tt>, <span>a <a href="___Basic__List.html">basic list</a></span>, or <span>an <a href="___Z__Z.html">integer</a></span>. If an integer is given, then the sequence <tt>0..L-1</tt> is used.</span></li> <li><span><tt>f</tt>, <span>a <a href="___Function.html">function</a></span>, which returns true or false</span></li> </ul> </div> </li> <li><div class="single">Outputs:<ul><li><span><span>a <a href="___Boolean.html">Boolean value</a></span>, <a href="_true.html" title="">true</a> if <tt>f</tt> returns true when applied to any element of <tt>L</tt> and <a href="_false.html" title="">false</a> otherwise</span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><table class="examples"><tr><td><pre>i1 : any({1,2,3,4}, even) o1 = true</pre> </td></tr> <tr><td><pre>i2 : any({1,3,5,7}, even) o2 = false</pre> </td></tr> <tr><td><pre>i3 : any(20,n -> n == 15) o3 = true</pre> </td></tr> </table> <p>We can test whether a permutation has a fixed point as follows.</p> <table class="examples"><tr><td><pre>i4 : fp = x -> any(#x, i -> x#i == i);</pre> </td></tr> <tr><td><pre>i5 : fp {2,3,4,0,1} o5 = false</pre> </td></tr> <tr><td><pre>i6 : fp {2,4,0,3,1} o6 = true</pre> </td></tr> </table> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_scan.html" title="apply a function to each element">scan</a> -- apply a function to each element</span></li> <li><span><a href="_apply.html" title="apply a function to each element">apply</a> -- apply a function to each element</span></li> <li><span><a href="_select.html" title="select from a list, hash table, or string">select</a> -- select from a list, hash table, or string</span></li> <li><span><a href="_any.html" title="whether any elements satisfy a specified condition">any</a> -- whether any elements satisfy a specified condition</span></li> <li><span><a href="_member.html" title="test membership in a list or set">member</a> -- test membership in a list or set</span></li> </ul> </div> </div> </body> </html>