commit 3f0bcf0e03d0d5900a89085f1c11865b7699d2f2
parent 313b744100f81cd3d63d5329b97a5be2131c7749
Author: NunoSempere <nuno.semperelh@protonmail.com>
Date: Sun, 9 Jun 2024 22:27:49 +0200
starting adding interfaces + use go mod to allow for imports
Diffstat:
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/f.go b/f.go
@@ -11,7 +11,23 @@ import (
)
const NORMAL90CONFIDENCE = 1.6448536269514727
-const general_err_msg = "Valid inputs: 2 || * 2 || / 2 || 2 20 || * 2 20 || / 2 20 || clean || =: var || op var || clean || help || debug || exit"
+const GENERAL_ERR_MSG = "Valid inputs: 2 || * 2 || / 2 || 2 20 || * 2 20 || / 2 20 || clean || =: var || op var || clean || help || debug || exit"
+
+// Distribution interface
+// https://go.dev/tour/methods/9
+
+type Distribution interface {
+ Samples() []float64
+}
+
+type Lognormal struct {
+ low float64
+ high float64
+}
+
+func (l Lognormal) Samples() []float64 {
+
+}
// Actually, I should look up how do do a) enums in go, b) union types
type Lognormal struct {
@@ -27,7 +43,7 @@ type Dist struct {
// Parse line into Distribution
func parseLineErr(err_msg string) (string, Dist, error) {
- fmt.Println(general_err_msg)
+ fmt.Println(GENERAL_ERR_MSG)
fmt.Println(err_msg)
return "", Dist{}, errors.New(err_msg)
}
@@ -179,7 +195,7 @@ EventForLoop:
case words[0] == "exit" || words[0] == "e":
break EventForLoop
case words[0] == "help" || words[0] == "h":
- fmt.Println(general_err_msg)
+ fmt.Println(GENERAL_ERR_MSG)
continue EventForLoop
case words[0] == "debug" || words[0] == "d":
fmt.Printf("Old dist: %v\n", old_dist)
diff --git a/go.mod b/go.mod
@@ -0,0 +1,3 @@
+module git.nunosempere.com/NunoSempere/fermi.git
+
+go 1.22.1