diff --git a/README.md b/README.md index 4f16313..f6f083e 100644 --- a/README.md +++ b/README.md @@ -183,17 +183,17 @@ Here's an explanation of some key parts of this package: - The Trit type is used to represent a "trinary digit," which can take on three states: False, Unknown, and True. - - Package defineds various methods on the Trit type that allow you to perform operations on trinary digits, including determining if a trinary digit represents False, Unknown, or True, setting the value of a trinary digit based on an integer, normalizing a trinary digit, converting a trinary digit to an integer or a string, and performing logical NOT, AND, OR, XOR, NAND, NOR, and XNOR operations on trinary digits. + - Package defineds various methods on the Trit type that allow you to perform operations on trinary digits, including determining if a trinary digit represents False, Unknown, or True, setting the value of a trinary digit based on an integer, normalizing a trinary digit, converting a trinary digit to an integer or a string. - The Trit type is defined as an alias for int8, and it can take one of three constants as its value: False, Unknown, or True. False corresponds to any negative number (including -1), Unknown corresponds to 0, and True corresponds to any positive number (including 1). - - There are four methods (Def, DefTrue, DefFalse, and Clean) that check if the value of a Trit is Unknown and change its value based on the method called. For instance, DefTrue will set the Trit to True if its current value is Unknown. + - Provides methods default state (like Default, TrueIfUnknown, FalseIFUnknown etc.,) that check if the value of a Trit is Unknown and change its value based on the method called. For instance, TrueIfUnknown will set the Trit to True if its current value is Unknown. - - There are three methods (IsFalse, IsUnknown, and IsTrue) that check the state of a Trit and return a boolean indicating if the Trit is in the corresponding state. + - There are some methods (like IsFalse, IsUnknown, IsTrue, IsConfidence etc.,) that check the state of a Trit and return a boolean indicating if the Trit is in the corresponding state. - - These methods perform various operations like assigning a value to a Trit (Set), returning the normalized value of a Trit (Val), normalizing the Trit in place (Norm), getting the integer representation of the Trit (Int), and getting the string representation of the Trit (String). + - Some methods perform various operations like assigning a value to a Trit (Set), returning the normalized value of a Trit (Val), normalizing the Trit in place (Norm), getting the integer representation of the Trit (Int), and getting the string representation of the Trit (String). - - There are several methods for performing logic operations on Trit values including Not, And, Or, Xor, Nand, and Nor. These methods implement trinary logic versions of their respective boolean logic operations. + - There are several methods for performing logic operations on Trit values including Not, And, Or, Xor, Nand, Nor etc. These methods implement trinary logic versions of their respective boolean logic operations. - The logic operation methods follow truth tables for ternary logic which are defined in the package comment section. diff --git a/fn.go b/fn.go index f59ff02..c97850a 100644 --- a/fn.go +++ b/fn.go @@ -333,17 +333,17 @@ func Neq[T, U Logicable](a T, b U) Trit { return ta.Neq(tb) } -// Confidence returns boolean true if all Trit-Like values has definiteness, +// IsConfidence returns boolean true if all Trit-Like values has definiteness, // i.e. is either True or False. // // Example usage: // -// a := trit.Confidence(trit.True, trit.False, trit.Unknown) +// a := trit.IsConfidence(trit.True, trit.False, trit.Unknown) // fmt.Println(a.String()) // Output: False // -// b := trit.Confidence(trit.True, trit.True, trit.False) +// b := trit.IsConfidence(trit.True, trit.True, trit.False) // fmt.Println(b.String()) // Output: True -func Confidence[T Logicable](ts ...T) bool { +func IsConfidence[T Logicable](ts ...T) bool { for _, t := range ts { trit := logicToTrit(t) if trit == Unknown { diff --git a/fn_test.go b/fn_test.go index 86053b3..fe6efb1 100644 --- a/fn_test.go +++ b/fn_test.go @@ -802,35 +802,35 @@ func TestNeq(t *testing.T) { } } -// TestConfidence tests the Confidence function. -func TestConfidence(t *testing.T) { +// TestIsConfidence tests the IsConfidence function. +func TestIsConfidence(t *testing.T) { tests := []struct { name string in []Trit out bool }{ { - name: "Confidence should return true for (True, True, True)", + name: "IsConfidence should return true for (True, True, True)", in: []Trit{True, True, True}, out: true, }, { - name: "Confidence should return true for (True, True, False)", + name: "IsConfidence should return true for (True, True, False)", in: []Trit{True, True, False}, out: true, }, { - name: "Confidence should return true for (False, False, False)", + name: "IsConfidence should return true for (False, False, False)", in: []Trit{False, False, False}, out: true, }, { - name: "Confidence should return false for (False, Unknown, True)", + name: "IsConfidence should return false for (False, Unknown, True)", in: []Trit{False, Unknown, True}, out: false, }, { - name: "Confidence should return false for (Unknown, Unknown)", + name: "IsConfidence should return false for (Unknown, Unknown)", in: []Trit{Unknown, Unknown}, out: false, }, @@ -838,9 +838,9 @@ func TestConfidence(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - result := Confidence(test.in...) + result := IsConfidence(test.in...) if result != test.out { - t.Errorf("Confidence did not return %v for %v", + t.Errorf("IsConfidence did not return %v for %v", test.out, test.in) } })