diff options
| author | demo <demo@antix1> | 2026-05-30 11:23:03 -0400 |
|---|---|---|
| committer | demo <demo@antix1> | 2026-05-30 11:23:03 -0400 |
| commit | b887bf08e6fd914d1adc7f13a14d824f74983c9c (patch) | |
| tree | 7963e748bef2ad96f138098dc150235c14958abd | |
| parent | 4018e8570d4a1f2ad1b54201aafc1978de6428dd (diff) | |
docs: add godoc to each library function
| -rw-r--r-- | hamlet.go | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -10,16 +10,20 @@ func (a Assertion) Assert() bool { return a.value } +// New returns a new Assertion. An assertion is true iff its +// underlying value is non-zero in the Go sense. func New(v any) Assertion { return Assertion{!reflect.ValueOf(v).IsZero()} } +// Not computes ~a, given assertion a. func Not(a Assertion) Assertion { negation := !a.value return Assertion{negation} } +// Or computes a v b, given assertions a and b. func Or(a Assertion, b Assertion) Assertion { av := a.value bv := b.value @@ -27,6 +31,7 @@ func Or(a Assertion, b Assertion) Assertion { return Assertion{av || bv} } +// And computes a ^ b, given assertions a and b. func And(a Assertion, b Assertion) Assertion { av := a.value bv := b.value @@ -34,14 +39,17 @@ func And(a Assertion, b Assertion) Assertion { return Assertion{av && bv} } +// If computes a → b, given assertions a and b. func If(a Assertion, b Assertion) Assertion { return Or(Not(a), b) } +// If computes a ↔ b, given assertions a and b. func Iff(a Assertion, b Assertion) Assertion { return And(If(a, b), If(b, a)) } +// Xor computes a ⊻ b, given assertions a and b. func Xor(a Assertion, b Assertion) Assertion { return Not(Iff(a, b)) } |
