Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 7ebd25ac536d248d499a3ce2acda963a > files > 3912

Macaulay2-1.3.1-8.fc15.i686.rpm

<?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>VisibleList / Function -- apply a function to elements of a list</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_w3.html">next</a> | <a href="___Virtual__Tally.html">previous</a> | <a href="_w3.html">forward</a> | <a href="___Virtual__Tally.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>VisibleList / Function -- apply a function to elements of 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>x/f</tt><br/><tt>f\x</tt></div>
</dd></dl>
</div>
</li>
<li><span>Operator: <a href="__sl.html" title="a binary operator, usually used for division">/</a></span></li>
<li><div class="single">Inputs:<ul><li><span><tt>x</tt>, <span>a <a href="___Visible__List.html">visible list</a></span>, <span>a <a href="___List.html">list</a></span>, <span>a <a href="___Sequence.html">sequence</a></span>, <span>an <a href="___Array.html">array</a></span>, <span>a <a href="___Tally.html">tally</a></span>, or <span>a <a href="___Set.html">set</a></span></span></li>
<li><span><tt>f</tt>, <span>a <a href="___Function.html">function</a></span>, <span>a <a href="___Command.html">command</a></span>, <span>a <a href="___Self__Initializing__Type.html">self initializing type</a></span>, or <span>a <a href="___Ring__Map.html">ring map</a></span></span></li>
</ul>
</div>
</li>
<li><div class="single">Outputs:<ul><li><span><span>a <a href="___Visible__List.html">visible list</a></span>, the list, tally, or set obtained by applying <tt>f</tt> to each element of <tt>x</tt>; it has the same type as <tt>x</tt> has</span></li>
</ul>
</div>
</li>
</ul>
</div>
<div class="single"><h2>Description</h2>
<div><p>The function <a href="_apply.html" title="apply a function to each element">apply</a> does the same thing.</p>
<p>The operator <a href="__sl.html" title="a binary operator, usually used for division">/</a> is left associative, which means that <tt>w / f / g</tt> is interpreted as <tt>(w / f) / g</tt>.  The operator <a href="__bs.html" title="a binary operator">\</a> is right associative, so <tt>g \ f \ w</tt> is interpreted as <tt>g \ (f \ w)</tt>.  Both operators have parsing precedence lower than that of <a href="__at_at.html" title="a binary operator">@@</a>, which means that the previous two expressions are equivalent to <tt>w / g @@ f</tt> and <tt>g @@ f \ w</tt>, respectively. See <a href="_precedence_spof_spoperators.html" title="">precedence of operators</a>.</p>
<table class="examples"><tr><td><pre>i1 : f = x -> x+1

o1 = f

o1 : FunctionClosure</pre>
</td></tr>
<tr><td><pre>i2 : g = x -> 2*x

o2 = g

o2 : FunctionClosure</pre>
</td></tr>
<tr><td><pre>i3 : g \ (1 .. 10)

o3 = (2, 4, 6, 8, 10, 12, 14, 16, 18, 20)

o3 : Sequence</pre>
</td></tr>
<tr><td><pre>i4 : (1 .. 10) / g

o4 = (2, 4, 6, 8, 10, 12, 14, 16, 18, 20)

o4 : Sequence</pre>
</td></tr>
<tr><td><pre>i5 : f \ g \ (1 .. 10)

o5 = (3, 5, 7, 9, 11, 13, 15, 17, 19, 21)

o5 : Sequence</pre>
</td></tr>
<tr><td><pre>i6 : f @@ g \ (1 .. 10)

o6 = (3, 5, 7, 9, 11, 13, 15, 17, 19, 21)

o6 : Sequence</pre>
</td></tr>
<tr><td><pre>i7 : set (1 .. 10)

o7 = set {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

o7 : Set</pre>
</td></tr>
<tr><td><pre>i8 : g \ oo

o8 = set {2, 4, 6, 8, 10, 12, 14, 16, 18, 20}

o8 : Set</pre>
</td></tr>
<tr><td><pre>i9 : R = QQ[x];</pre>
</td></tr>
<tr><td><pre>i10 : f = map(R,R,{x^2})
--warning: function f redefined

                2
o10 = map(R,R,{x })

o10 : RingMap R &lt;--- R</pre>
</td></tr>
<tr><td><pre>i11 : f \ {x,x^2,x^3,x^4}

        2   4   6   8
o11 = {x , x , x , x }

o11 : List</pre>
</td></tr>
</table>
</div>
</div>
<div class="waystouse"><div class="single"><h2>Code</h2>
<pre>../../m2/classes.m2:49:49-49:60: --source code:
VisibleList /  Function := VisibleList => (v,f) -> apply(v,f)</pre>
</div>
</div>
</div>
</body>
</html>