type wranging

This commit is contained in:
NunoSempere 2024-06-10 00:05:23 +02:00
parent b0adde937f
commit 8b1792f861

12
f.go
View File

@ -213,10 +213,11 @@ func prettyPrintLognormal(low float64, high float64) {
}
func prettyPrintDist(dist Dist) {
if dist.Type() == "Lognormal" {
prettyPrintLognormal(dist.low, dist.high)
} else {
fmt.Printf("%v", dist)
switch v := dist.(type) {
case Lognormal:
prettyPrintLognormal(v.low, v.high)
default:
fmt.Printf("%v", v)
}
}
@ -228,7 +229,8 @@ func main() {
fmt.Printf("%v\n", x)
reader := bufio.NewReader(os.Stdin)
init_dist := Dist{Type: "Lognormal", Lognormal: Lognormal{low: 1, high: 1}, Samples: nil} // Could also just be a scalar
var init_dist Dist
init_dist = Lognormal{low: 1, high: 1}
old_dist := init_dist
vars := make(map[string]Dist)
// Could eventually be a more complex struct with: