DyadicOperator

com.phasmidsoftware.number.algebra.core.DyadicOperator
trait DyadicOperator[A]

A trait that represents a dyadic operator, which performs an operation involving two operands of types related to A and produces a result wrapped in a Try.

NOTE the purpose of this trait is to deal with the hierarchy of types in one place. However, we have instead implemented eqv and fuzzyEqv directly (not using this trait). We can implement other operators using this trait if we wish, and maybe even back-propagate the eqv and fuzzyEqv methods here also.

Type parameters

A

The base type of the operands, which acts as the upper bound for the types used in the operation.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def op[B <: A, Z](f: (A, B) => Try[Z])(x: A, y: B): Try[Z]

Applies a binary operation defined by the function f to the operands x and y. The result of the operation is returned as a Try to safely handle potential failures.

Applies a binary operation defined by the function f to the operands x and y. The result of the operation is returned as a Try to safely handle potential failures.

Value parameters

f

A function that takes two operands of types A and B and performs an operation, producing a result of type Z wrapped in a Try.

x

The first operand of the operation, of type A.

y

The second operand of the operation, of type B, which is constrained to be a subtype of A.

Attributes

Returns

The result of applying the function f to the operands x and y, wrapped in a Try.