some common functions taking two arguments, sometimes expressed as infix operators:

addition subtraction multiplication division exponentiation

mod (remainder)

atan2, x^2+y^2, sqrt(x^2+y^2)

create a complex number from real and imaginary components

or, from polar components

arithmetic, geometric, harmonic means of 2 numbers

arithmetic-geometric mean (AGM)

b^2-4c (monic quadratic discriminant)

nth root

and or xor nand nor xnor

gcd lcm

binomial coefficient (n choose k)

Legendre symbol, Jacobi symbol

multiplicative inverse in GF(p) finite field. this requires p to be prime.

comparison operators

minimum or maximum of two numbers

append an item to the beginning of a list. or end.

join two binary trees. more generally, combine two container data structures. even more generally, a magma in abstract algebra.

set union, intersection, difference.

set membership (predicate).

symmetric encryption, decryption (without nonce or initialization vector): arguments are key and plaintext or ciphertext.

keyed hash function (message authentication code (MAC)): arguments are key and message.

distance between two points.

vectors: dot product, cross product, angle between.

any noncommutative function above with arguments flipped.

motivation: when designing a programming language, it is important to support binary functions, for example, right sections.

## No comments :

Post a Comment