61 lines
1.1 KiB
Go
61 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
// "math"
|
|
"os"
|
|
// "strconv"
|
|
"strings"
|
|
)
|
|
|
|
// Actually, I should look up how do do a) enums in go, b) union types
|
|
type Lognormal struct {
|
|
low float64
|
|
high float64
|
|
}
|
|
|
|
type Dist struct {
|
|
Type string
|
|
Lognormal Lognormal
|
|
Samples []float64
|
|
}
|
|
|
|
func parseLine(line string) (string, Dist, error) {
|
|
|
|
words := strings.Split(strings.TrimSpace(line), " ")
|
|
|
|
switch {
|
|
case len(words) == 2 && words[0] == "*":
|
|
fmt.Printf("Hello world")
|
|
}
|
|
}
|
|
|
|
func joinDists(old_dist Dist, new_dist Dist, op string) (Dist, err) {
|
|
return old_dist, nil
|
|
}
|
|
|
|
func main() {
|
|
reader := bufio.NewReader(os.Stdin)
|
|
old_dist := Dist{Type: "Lognormal", Lognormal: Lognormal{low: 1, high: 1}, Samples: nil} // Could also just be a scalar
|
|
fmt.Printf("Hello world")
|
|
|
|
EventForLoop:
|
|
for {
|
|
input, _ := reader.ReadString('\n')
|
|
if strings.TrimSpace(input) == "" {
|
|
continue EventForLoop
|
|
}
|
|
|
|
op, new_dist, err := parseLine(input)
|
|
if err != nil {
|
|
|
|
}
|
|
joint_dist, err := joinDists(old_dist, new_dist, op)
|
|
if err != nil {
|
|
|
|
}
|
|
old_dist = joint_dist
|
|
}
|
|
}
|