starting adding interfaces + use go mod to allow for imports

This commit is contained in:
NunoSempere 2024-06-09 22:27:49 +02:00
parent 313b744100
commit 3f0bcf0e03
2 changed files with 22 additions and 3 deletions

22
f.go
View File

@ -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)

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module git.nunosempere.com/NunoSempere/fermi.git
go 1.22.1