Last active
May 11, 2020 17:31
-
-
Save eMdOS/bf05d2d439e177e51822e9aa8a90c0c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public extension AssociativeLaw where Element: Semigroup { | |
/// | |
/// It verifies if the set of elements are **associative** through Semigroup's composition (`<>`). | |
/// | |
/// The `<>` operator is used to express associativity in an abstract way. | |
/// This is because elements can either be associative through *addition* (`+`) or through *multiplication* (`*`). | |
/// | |
/// - Parameters: | |
/// - a: The first semigroup element | |
/// - b: The second semigroup element | |
/// - c: The third semigroup element | |
/// | |
static func verify(a: Element, b: Element, c: Element) -> Bool { | |
verify(a: a, b: b, c: c, operation: <>) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment