# Is it possible to declare functions that work for "other kinds" of arguments such as n-uples?

For example: Can we declare a function that works on pairs? Like $$f(\{x,y\})$$ or define an operation on pairs like $$\{x,y\}\circ \{X,Y\}$$?

I tried to look at f@@ but it doesn't seems to be what I want. I could declare a function such as

f[x_, y_, X_, Y_] := {x \[Theta][y] X, y Y}


And then compute

f @@ {a, b, c, d}


But this is not too "natural". Given what I know, If I want to compute, for example $$\{x,y\} \circ \{x',y'\} \circ \{x'',y''\}$$, I'd have to make a set $$\{x,y,x',y'\}$$, use f@@ which would yield another set of two elements, and now to compute the remaining operation, I'd have to construct a set with $$\{i,j,x'',y''\}$$ and then apply f@@ again. This is rather cumbersome.I'd like to construct an operation where I could really type $$\{x,y\} \circ \{x',y'\} \circ \{x'',y''\}$$ and it would work.

Edit

SetAttributes[CircleDot, {Flat, OneIdentity}];
CircleDot[{x_, y_}, {a_, b_}] := {x ** θ[y] ** a, y ** b};
{g1,h1}⊙{g2, h2}⊙{g3, h3}


{g1 ** θ[h1] ** g2 ** θ[h1 ** h2] ** g3, h1 ** h2 ** h3}

Update

SetAttributes[CircleDot, {Orderless, Flat, OneIdentity}];
CircleDot[{x_, y_}, {a_, b_}] := {x*θ[y]*a, y*b}
{g1, h1}⊙{g2, h2}⊙{g3, h3}


{g1 g2 g3 θ[h2] θ[h1 h2], h1 h2 h3}

SetAttributes[
CircleDot, {NumericFunction, Orderless, Flat, OneIdentity}];
CircleDot[{x_, y_}, {a_, b_}] := {a*x, b*y};
{x, y}⊙{a, b}⊙{m, n}


{a m x, b n y}

• This is really nice! I am doing the following and it seems to be assuming that things associate and commute. Can we stop that? Commented Mar 12, 2021 at 1:13
• @BillyRubina What is $\theta$? You can edit you question and add the new code about $\theta$ Commented Mar 12, 2021 at 2:22
• It is a function but I'd like to leave it unevaluated in the form $\theta(x)$. The trouble is that Mathematica changes the order, I don't know why. Commented Mar 12, 2021 at 2:29
• @ SetAttributes[CircleDot, {Orderless, Flat, OneIdentity}]; CircleDot[{x_, y_}, {a_, b_}] := {x*θ[y]*a, y*b} {g1, h1}⊙{g2, h2}⊙{g3, h3} ? Commented Mar 12, 2021 at 2:46
• @BillyRubina SetAttributes[CircleDot, {Flat, OneIdentity}]; CircleDot[{x_, y_}, {a_, b_}] := {x ** \[Theta][y] ** a, y ** b}; {g1, h1}\[CircleDot]{g2, h2}\[CircleDot]{g3, h3} Commented Mar 12, 2021 at 3:44