Associative

Associative -- an option name for method which allows associative methods to be created.

f = method(Associative=>true) -- creates an associative method which will call upon the appropriate binary methods for its arguments two at a time.

In the following example we install a method which isn't associative to illustrate the order of evaluation.

     i1 = f = method(Associative => true)
     
     o1 = f
     
     o1 : Function
     
     i2 = f(String,String) := (i,j) -> "(" | i | ")," | j;
     
     i3 = f("a","b","c","d")
     
     o3 = "(((a),b),c),d"
     

See also method.

Go to main index.

Go to concepts index.