<?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>apply(BasicList,BasicList,Function) -- apply a function to pairs of elements, one from each list</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_apply_lp__Z__Z_cm__Function_rp.html">next</a> | <a href="_apply.html">previous</a> | <a href="_apply_lp__Z__Z_cm__Function_rp.html">forward</a> | <a href="_apply.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>apply(BasicList,BasicList,Function) -- apply a function to pairs of elements, one from each 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>apply(L1,L2,f)</tt></div> </dd></dl> </div> </li> <li><span>Function: <a href="_apply.html" title="apply a function to each element">apply</a></span></li> <li><div class="single">Inputs:<ul><li><span><tt>L1</tt>, <span>a <a href="___Basic__List.html">basic list</a></span></span></li> <li><span><tt>L2</tt>, <span>a <a href="___Basic__List.html">basic list</a></span>, of the same length as <tt>L1</tt></span></li> <li><span><tt>f</tt>, <span>a <a href="___Function.html">function</a></span>, with two arguments</span></li> </ul> </div> </li> <li><div class="single">Outputs:<ul><li><span><span>a <a href="___Basic__List.html">basic list</a></span>, with the ith element obtained by evaluating <tt>f(L1_i,L2_i)</tt></span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div>The result will have the same class as the class of <tt>L1</tt> and <tt>L2</tt>.<table class="examples"><tr><td><pre>i1 : apply({1,2,3}, {100,200,300}, (i,j) -> i+j) o1 = {101, 202, 303} o1 : List</pre> </td></tr> <tr><td><pre>i2 : apply([1,2,3], [100,200,300], (i,j) -> i+j) o2 = [101, 202, 303] o2 : Array</pre> </td></tr> <tr><td><pre>i3 : apply((1,2,3), (100,200,300), (i,j) -> i+j) o3 = (101, 202, 303) o3 : Sequence</pre> </td></tr> </table> </div> </div> </div> </body> </html>