Sophie

Sophie

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

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>:= -- assignment of method or new local variable</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="__lt-.html">next</a> | <a href="__eq.html">previous</a> | <a href="__lt-.html">forward</a> | <a href="__eq.html">backward</a> | <a href="_operators.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="_operators.html" title="">operators</a> > <a href="__co_eq.html" title="assignment of method or new local variable">:=</a></div>
<hr/>
<div><h1>:= -- assignment of method or new local variable</h1>
<div class="single"><h2>Description</h2>
<div><p>In this section we'll discuss simple local assignment to variables, multiple local assignment, and installation and use of method functions.  See also the operator <a href="__eq.html" title="assignment">=</a>, which handles other forms of assignment, as well as the operator <a href="__lt-.html" title="assignment with left side evaluated">&lt;-</a>, which is an assignment operator that evaluates its left hand side and can have assignment methods installed for it by the user.</p>
<div><h2>simple local assignment</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>x := e</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>x</tt>, <span>a <a href="___Symbol.html">symbol</a></span>,  (unevaluated)</span></li>
<li><span><tt>e</tt>, <span>a <a href="___Thing.html">thing</a></span></span></li>
</ul>
</li>
<li>Consequences:<ul><li>a new local variable <tt>x</tt> is created.  The scope of <tt>x</tt> is the current function body, or if there is none, the current file</li>
<li><tt>e</tt> is assigned to <tt>x</tt>, so future references to the value of <tt>x</tt> yield <tt>e</tt></li>
<li>a warning message is issued if a local variable with the same name has already been created</li>
</ul>
</li>
<li>Outputs:<ul><li><span><span>a <a href="___Thing.html">thing</a></span>, the value of the expression is <tt>e</tt></span></li>
</ul>
</li>
</ul>
<table class="examples"><tr><td><pre>i1 : x

o1 = x

o1 : Symbol</pre>
</td></tr>
<tr><td><pre>i2 : x := 4

o2 = 4</pre>
</td></tr>
<tr><td><pre>i3 : x

o3 = 4</pre>
</td></tr>
</table>
<p>In the next example, we see that the scope of the local variable <tt>p</tt> is limited to the body of the function.</p>
<table class="examples"><tr><td><pre>i4 : g = () -> ( p := 444; p )

o4 = g

o4 : FunctionClosure</pre>
</td></tr>
<tr><td><pre>i5 : g()

o5 = 444</pre>
</td></tr>
<tr><td><pre>i6 : p

o6 = p

o6 : Symbol</pre>
</td></tr>
</table>
<p>In this example, we see that a function returned by another function retains access to the values of local variables in its scope.</p>
<table class="examples"><tr><td><pre>i7 : g = () -> ( p := 444; () -> p )
--warning: function g redefined

o7 = g

o7 : FunctionClosure</pre>
</td></tr>
<tr><td><pre>i8 : g()

o8 = {*Function[stdio:7:25-7:28]*}

o8 : FunctionClosure</pre>
</td></tr>
<tr><td><pre>i9 : oo ()

o9 = 444</pre>
</td></tr>
</table>
<p>Functions returned by a function can also modify local variables within their scope, thereby communicating with each other.</p>
<table class="examples"><tr><td><pre>i10 : g = () -> ( p := 444; (() -> p, i -> p = i))
--warning: function g redefined

o10 = g

o10 : FunctionClosure</pre>
</td></tr>
<tr><td><pre>i11 : (b,c) = g()

o11 = (b, c)

o11 : Sequence</pre>
</td></tr>
<tr><td><pre>i12 : b()

o12 = 444</pre>
</td></tr>
<tr><td><pre>i13 : c 555

o13 = 555</pre>
</td></tr>
<tr><td><pre>i14 : b()

o14 = 555</pre>
</td></tr>
</table>
<p>Since the value of the entire expression is <tt>e</tt>, and since the operator <a href="__eq.html" title="assignment">=</a> is right-associative (see <a href="_precedence_spof_spoperators.html" title="">precedence of operators</a>), <tt>e</tt> can be easily assigned to more than one variable, as in the following example.</p>
<table class="examples"><tr><td><pre>i15 : a := b := 44

o15 = 44</pre>
</td></tr>
<tr><td><pre>i16 : a

o16 = 44</pre>
</td></tr>
<tr><td><pre>i17 : b

o17 = 44</pre>
</td></tr>
</table>
<p>By the way, there is a difference between a variable (to which values can be assigned) and a symbol (which can be used as an indeterminate in making a polynomial ring).  If you want a local variable to which is assigned the corresponding local symbol, then combine the use of <a href="__co_eq.html" title="assignment of method or new local variable">:=</a> with the use of <a href="_local.html" title="get a local symbol">local</a>, as in the following example, which illustrates a good way to do a computation in a temporary ring without disturbing the values of any global variables.</p>
<table class="examples"><tr><td><pre>i18 : g = () -> (
           x := local x;
           R := QQ[x];
           (x+2)^10);
--warning: function g redefined</pre>
</td></tr>
</table>
</div>
<div><h2>multiple local assignment</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>(x,y,z,...) := (c,d,e,...)</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>(x,y,z,...)</tt> a <a href="___Sequence.html">sequence</a> of <a href="___Symbol.html">symbols</a> (unevaluated)</span></li>
<li><span><tt>(c,d,e,...)</tt> a <a href="___Sequence.html">sequence</a> of <a href="___Thing.html">things</a></span></li>
</ul>
</li>
<li>Consequences:<ul><li>new local variables <tt>x</tt>, <tt>y</tt>, <tt>z</tt>, ... are created</li>
<li>the expressions c,d,e,... are assigned to the variables x,y,z,..., respectively, as above.</li>
<li>If the left hand side has more elements than the right hand side, then the extra symbols on the left side are given the value <a href="_null.html" title="the unique member of the empty class">null</a>.</li>
<li>If the left hand side has fewer elements than the right hand side, then the last symbol on the left hand side is given as value a sequence containing the trailing elements of the right hand side.</li>
<li>If the right hand side is not a sequence, then it is assigned to the first symbol on the left, and the remaining symbols are assigned the value <a href="_null.html" title="the unique member of the empty class">null</a>.</li>
</ul>
</li>
<li>Outputs:<ul><li><span>the value of the expression is <tt>(c,d,e,...)</tt></span></li>
</ul>
</li>
</ul>
<p>Multiple assignment effectively means that functions can return multiple values usefully.</p>
<table class="examples"><tr><td><pre>i19 : g()

       10      9       8       7        6        5         4         3  
o19 = x   + 20x  + 180x  + 960x  + 3360x  + 8064x  + 13440x  + 15360x  +
      -----------------------------------------------------------------------
            2
      11520x  + 5120x + 1024

o19 : QQ[x]</pre>
</td></tr>
<tr><td><pre>i20 :                
      f = i -> (i,i^2)

o20 = f

o20 : FunctionClosure</pre>
</td></tr>
<tr><td><pre>i21 : (r,s) := f 9

o21 = (9, 81)

o21 : Sequence</pre>
</td></tr>
<tr><td><pre>i22 : r

o22 = 9</pre>
</td></tr>
</table>
</div>
<div><h2>installing methods for binary operators</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>X OP Y := (x,y) -> ...</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>X</tt>, <span>a <a href="___Type.html">type</a></span></span></li>
<li><span><tt>OP</tt>, one of the binary operators for which users may install methods, namely: <a href="__pc.html" title="a binary operator, usually used for remainder and reduction">%</a> <a href="__am.html" title="a binary operator">&amp;</a> <a href="__st.html" title="a binary operator, usually used for multiplication">*</a> <a href="__st_st.html" title="a binary operator, usually used for tensor product or Cartesian product">**</a> <a href="__pl.html" title="a unary or binary operator, usually used for addition">+</a> <a href="__pl_pl.html" title="a binary operator, usually used for direct sum">++</a> <a href="_-.html" title="a unary or binary operator, usually used for negation or subtraction">-</a> <a href="_...html" title="a binary operator, used for sequences of consecutive items">..</a> <a href="_.._lt.html" title="a binary operator, used for sequences of consecutive items, not including the endpoint">..&lt;</a> <a href="__sl.html" title="a binary operator, usually used for division">/</a> <a href="__sl_sl.html" title="a binary operator, usually used for quotient">//</a> <a href="__co.html" title="a binary operator, uses include repetition; ideal quotients">:</a> <a href="__lt_lt.html" title="a binary operator (file output, ...)">&lt;&lt;</a> <a href="__lt_eq_eq.html" title="a unary and binary operator">&lt;==</a> <a href="__lt_eq_eq_eq.html" title="a unary and binary operator">&lt;===</a> <a href="__lt_eq_eq_gt.html" title="a binary operator">&lt;==></a> <a href="__eq_eq.html" title="equality">==</a> <a href="__eq_eq_eq_gt.html" title="a binary operator">===></a> <a href="__eq_eq_gt.html" title="a binary operator">==></a> <a href="__gt_gt.html" title="a binary operator, uses include bit shifting, or attaching optional inputs to functions">>></a> <a href="__qu.html" title="comparison operator">?</a> <a href="__at.html" title="a binary operator">@</a> <a href="__at_at.html" title="a binary operator">@@</a> <a href="__bs.html" title="a binary operator">\</a> <a href="__bs_bs.html" title="a binary operator">\\</a> <a href="_^.html" title="a binary operator, usually used for powers">^</a> <a href="_^_st_st.html" title="a binary operator, usually used for tensor or Cartesian power">^**</a> <a href="_^^.html" title="a binary operator">^^</a> <a href="__us.html" title="a binary operator, used for subscripting and access to elements">_</a> <a href="__vb.html" title="a binary operator, often used for horizontal concatenation">|</a> <a href="__vb-.html" title="a binary operator">|-</a> <a href="__vb_vb.html" title="a binary operator, often used for vertical concatenation">||</a> <a href="_and.html" title="conjunction">and</a> <a href="_or.html" title="disjunction">or</a> <a href="___S__P__A__C__E.html" title="blank operator; often used for function application, making polynomial rings">SPACE</a> .  The operator SPACE, indicating adjacency, may be omitted from the usage above.</span></li>
<li><span><tt>Y</tt>, <span>a <a href="___Type.html">type</a></span></span></li>
<li><span><tt>(x,y) -> ...</tt>, <span>a <a href="___Function.html">function</a></span></span></li>
</ul>
</li>
<li>Consequences:<ul><li>the function on the right hand side is installed as the method for <tt>X OP Y</tt>.  See the next subsection below for using it.</li>
</ul>
</li>
<li>Outputs:<ul><li><span>the value of the expression is the same as the function on the right hand side</span></li>
</ul>
</li>
</ul>
The first line of the following example illustrates the syntax above.<table class="examples"><tr><td><pre>i23 : s

o23 = 81</pre>
</td></tr>
<tr><td><pre>i24 : String * String := peek;</pre>
</td></tr>
</table>
<p>Warning: the installation of new methods may supplant old ones, changing the behavior of Macaulay2.</p>
</div>
<div><h2>using methods for binary operators</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>x OP y</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>x</tt>, an object of type <tt>X</tt></span></li>
<li><span><tt>OP</tt>, one of the binary operators for which users may install methods, listed above.  The operator SPACE, indicating adjacency, may be omitted from the usage above.</span></li>
<li><span><tt>y</tt>, an object of type <tt>Y</tt></span></li>
</ul>
</li>
<li>Outputs:<ul><li><span>the previously installed method for <tt>X OP Y</tt> is called with arguments <tt>(x,y)</tt>, and its return value is returned.  If no such method has been installed, then Macaulay2 searches for a method for <tt>X' OP Y'</tt>, where <tt>X'</tt> is an ancestor of <tt>X</tt> and <tt>Y'</tt> is an ancestor of <tt>Y</tt> (see <a href="_inheritance.html" title="">inheritance</a> for details).</span></li>
</ul>
</li>
</ul>
The second line of the following example illustrates the syntax above.<table class="examples"><tr><td><pre>i25 : "left" * "right"

o25 = ("left", "right")</pre>
</td></tr>
<tr><td><pre>i26 : String * Number := peek;</pre>
</td></tr>
<tr><td><pre>i27 : "left" * 33

o27 = ("left", 33)</pre>
</td></tr>
</table>
<p>Some methods for operators are </p>
<em>internal</em>, and cannot be successfully overridden by the user, as we illustrate in the next example, where we try (and fail) to override the definition of the sum of two integers.<table class="examples"><tr><td><pre>i28 : "left" * 3.3

o28 = ("left", 3.3)</pre>
</td></tr>
<tr><td><pre>i29 : ZZ + ZZ := (x,y) -> x+y+100

o29 = {*Function[stdio:33:17-33:24]*}

o29 : FunctionClosure</pre>
</td></tr>
</table>
By contrast, addition of complex numbers is not internal, and can be overridden.<table class="examples"><tr><td><pre>i30 : 3 + 4

o30 = 7</pre>
</td></tr>
<tr><td><pre>i31 : CC + CC := (w,z) -> w*z

o31 = {*Function[stdio:35:17-35:22]*}

o31 : FunctionClosure</pre>
</td></tr>
</table>
</div>
<div><h2>installing methods for unary prefix operators</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>OP X = (x) -> ...</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>OP</tt>, one of the unary prefix operators for which users may install methods, namely: <a href="__st.html" title="a binary operator, usually used for multiplication">*</a> <a href="__pl.html" title="a unary or binary operator, usually used for addition">+</a> <a href="_-.html" title="a unary or binary operator, usually used for negation or subtraction">-</a> <a href="__lt.html" title="less than">&lt;</a> <a href="__lt_lt.html" title="a binary operator (file output, ...)">&lt;&lt;</a> <a href="__lt_eq.html" title="less than or equal">&lt;=</a> <a href="__lt_eq_eq.html" title="a unary and binary operator">&lt;==</a> <a href="__lt_eq_eq_eq.html" title="a unary and binary operator">&lt;===</a> <a href="__gt.html" title="greater than">></a> <a href="__gt_eq.html" title="greater than or equal">>=</a> <a href="__qu.html" title="comparison operator">?</a> <a href="__vb-.html" title="a binary operator">|-</a> <a href="_not.html" title="negation">not</a></span></li>
<li><span><tt>X</tt>, <span>a <a href="___Type.html">type</a></span></span></li>
<li><span><tt>(x) -> ...</tt>, <span>a <a href="___Function.html">function</a></span></span></li>
</ul>
</li>
<li>Consequences:<ul><li>the function on the right hand side is installed as the method for <tt>OP X</tt>.  See the next subsection below for using it.</li>
</ul>
</li>
<li>Outputs:<ul><li><span>the value of the expression is the same as the function on the right hand side</span></li>
</ul>
</li>
</ul>
The first line of the following example illustrates the syntax above.<table class="examples"><tr><td><pre>i32 : ii + ii

o32 = 2*ii

o32 : CC (of precision 53)</pre>
</td></tr>
<tr><td><pre>i33 : - String := peek;</pre>
</td></tr>
</table>
<p>Warning: the installation of new methods may supplant old ones, changing the behavior of Macaulay2.</p>
</div>
<div><h2>using methods for unary prefix operators</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>OP x</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>OP</tt>, one of the unary prefix operators for which users may install methods, listed above.</span></li>
<li><span><tt>x</tt>, an object of type <tt>X</tt></span></li>
</ul>
</li>
<li>Outputs:<ul><li><span>the previously installed method for <tt>OP X</tt> is called with argument <tt>x</tt>, and its return value is returned.  If no such method has been installed, then Macaulay2 searches for a method for <tt>OP X'</tt>, where <tt>X'</tt> is an ancestor of <tt>X</tt> (see <a href="_inheritance.html" title="">inheritance</a> for details).</span></li>
</ul>
</li>
</ul>
The second line of the following example illustrates the syntax above.<table class="examples"><tr><td><pre>i34 : - "foo"

o34 = "foo"</pre>
</td></tr>
<tr><td><pre>i35 : - String := peek;</pre>
</td></tr>
</table>
</div>
<div><h2>installing methods for unary postfix operators</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>X OP = (x) -> ...</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>OP</tt>, one of the unary postfix operators for which users may install methods, namely: <a href="_!.html" title="factorial">!</a> <a href="__lp_st_rp.html" title="a unary postfix operator, used for indicating a graded object">(*)</a> <a href="_^_st.html" title="a unary postfix operator, used for indicating pullback maps">^*</a> <a href="__us_st.html" title="a unary postfix operator, used for indicating pushforward maps">_*</a> <a href="_~.html" title="a unary postfix operator">~</a></span></li>
<li><span><tt>X</tt>, <span>a <a href="___Type.html">type</a></span></span></li>
<li><span><tt>(x) -> ...</tt>, <span>a <a href="___Function.html">function</a></span></span></li>
</ul>
</li>
<li>Consequences:<ul><li>the function on the right hand side is installed as the method for <tt>OP X</tt>.  See the next subsection below for using it.</li>
</ul>
</li>
<li>Outputs:<ul><li><span>the value of the expression is the same as the function on the right hand side</span></li>
</ul>
</li>
</ul>
The first line of the following example illustrates the syntax above.<table class="examples"><tr><td><pre>i36 : - "foo"

o36 = "foo"</pre>
</td></tr>
<tr><td><pre>i37 : String ~ := peek;</pre>
</td></tr>
</table>
<p>Warning: the installation of new methods may supplant old ones, changing the behavior of Macaulay2.</p>
</div>
<div><h2>using methods for unary postfix operators</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>x OP</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>x</tt>, an object of type <tt>X</tt></span></li>
<li><span><tt>OP</tt>, one of the unary postfix operators for which users may install methods, listed above.</span></li>
</ul>
</li>
<li>Outputs:<ul><li><span>the previously installed method for <tt>X OP</tt> is called with argument= <tt>x</tt>, and its return value is returned.  If no such method has been installed, then Macaulay2 searches for a method for to <tt>X' OP</tt>, where <tt>X'</tt> is an ancestor of <tt>X</tt> (see <a href="_inheritance.html" title="">inheritance</a> for details).</span></li>
</ul>
</li>
</ul>
The second line of the following example illustrates the syntax above.<table class="examples"><tr><td><pre>i38 : "foo" ~

o38 = "foo"</pre>
</td></tr>
<tr><td><pre>i39 : String ~ := peek;</pre>
</td></tr>
</table>
</div>
<div><h2>installing unary methods for method functions</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>f X := (x) -> ...</tt><br/><tt>f(X) := (x) -> ...</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>f</tt>, a previously defined method function.  A method function may be created with the function <a href="_method.html" title="make a new method function">method</a>.</span></li>
<li><span><tt>X</tt>, <span>a <a href="___Type.html">type</a></span></span></li>
<li><span><tt>(x) -> ...</tt>, <span>a <a href="___Function.html">function</a></span></span></li>
</ul>
</li>
<li>Consequences:<ul><li>the function on the right hand side is installed as the method for assignment to <tt>f X</tt>.  See the next subsection below for using it.</li>
</ul>
</li>
</ul>
The first line of the following example illustrates the syntax above, using <a href="_source.html" title="source of a map">source</a>, which happens to be a method function.<table class="examples"><tr><td><pre>i40 : "foo" ~

o40 = "foo"</pre>
</td></tr>
<tr><td><pre>i41 : source String := peek;</pre>
</td></tr>
</table>
<p>Warning: the installation of new methods may supplant old ones, changing the behavior of Macaulay2.</p>
</div>
<div><h2>using unary methods for method functions</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>f x</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>f</tt>, a method function</span></li>
<li><span><tt>x</tt>, an object of type <tt>X</tt></span></li>
</ul>
</li>
<li>Outputs:<ul><li><span>the previously installed method for <tt>f X</tt> is called with argument <tt>x</tt>, and its return value is returned</span></li>
</ul>
</li>
</ul>
The second line of the following example illustrates the syntax above, using <a href="_source.html" title="source of a map">source</a>, which happens to be a method function.<table class="examples"><tr><td><pre>i42 : source "foo"

o42 = "foo"</pre>
</td></tr>
<tr><td><pre>i43 : source String := peek;</pre>
</td></tr>
</table>
</div>
<div><h2>installing binary methods for method functions</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>f(X,Y) := (x,y) -> ...</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>f</tt>, a previously defined method function.  A method function may be created with the function <a href="_method.html" title="make a new method function">method</a>.</span></li>
<li><span><tt>X</tt>, <span>a <a href="___Type.html">type</a></span></span></li>
<li><span><tt>Y</tt>, <span>a <a href="___Type.html">type</a></span></span></li>
<li><span><tt>(x,y) -> ...</tt>, <span>a <a href="___Function.html">function</a></span></span></li>
</ul>
</li>
<li>Consequences:<ul><li>the function on the right hand side is installed as the method for <tt>f(X,Y)</tt>.  See the next subsection below for using it.</li>
</ul>
</li>
</ul>
The first line of the following example illustrates the syntax above, using <a href="_source.html" title="source of a map">source</a>, which happens to be a method function.<table class="examples"><tr><td><pre>i44 : source "foo"

o44 = "foo"</pre>
</td></tr>
<tr><td><pre>i45 : source(String,Number) := peek;</pre>
</td></tr>
<tr><td><pre>i46 : source("foo",33)

o46 = ("foo", 33)</pre>
</td></tr>
</table>
<p>Warning: the installation of new methods may supplant old ones, changing the behavior of Macaulay2.</p>
<p>The same syntax works for 3 or 4 arguments.</p>
</div>
<div><h2>using binary methods for method functions</h2>
<ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>f(x,y)</tt></div>
</dd></dl>
</div>
</li>
<li>Inputs:<ul><li><span><tt>f</tt>, a method function</span></li>
<li><span><tt>x</tt>, an object of type <tt>X</tt></span></li>
<li><span><tt>y</tt>, an object of type <tt>Y</tt></span></li>
</ul>
</li>
<li>Outputs:<ul><li><span>the previously installed method for <tt>f(X,Y)</tt> is called with arguments <tt>(x,y)</tt>, and the return value is returned.  If no such method has been installed, then Macaulay2 searches for a method for <tt>f(X',Y')</tt>, where <tt>X'</tt> is an ancestor of <tt>X</tt> and <tt>Y'</tt> is an ancestor of <tt>Y</tt> (see <a href="_inheritance.html" title="">inheritance</a> for details).</span></li>
</ul>
</li>
</ul>
The second line of the following example illustrates the syntax above, using <a href="_source.html" title="source of a map">source</a>, which happens to be a method function.<table class="examples"><tr><td><pre>i47 : source("foo",3.3)

o47 = ("foo", 3.3)</pre>
</td></tr>
<tr><td><pre>i48 : source(String,String) := peek;</pre>
</td></tr>
</table>
<p>The same syntax works for 3 or 4 arguments.</p>
</div>
<p>Another use of the operator <a href="__co_eq.html" title="assignment of method or new local variable">:=</a> is for installing methods for creation of new objects.  For details, see <a href="_new.html" title="new objects and new types">new</a>.</p>
</div>
</div>
<div class="single"><h2>See also</h2>
<ul><li><span><a href="__eq.html" title="assignment">=</a> -- assignment</span></li>
<li><span><a href="__lt-.html" title="assignment with left side evaluated">&lt;-</a> -- assignment with left side evaluated</span></li>
<li><span><a href="_new.html" title="new objects and new types">new</a> -- new objects and new types</span></li>
</ul>
</div>
<div class="waystouse"><h2>For the programmer</h2>
<p>The object <a href="__co_eq.html" title="assignment of method or new local variable">:=</a> is <span>a <a href="___Keyword.html">keyword</a></span>.</p>
</div>
</div>
</body>
</html>