From 6686e4f919807b60b53153c6bd0ebd950c429715 Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 15 Sep 2024 16:33:56 -0400 Subject: [PATCH] add real life examples + simplify multiply code. --- README.md | 2 ++ fermi.go | 11 ++--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e4b68fb..8a61fae 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,8 @@ help exit ``` +You can see real life examples [here](https://x.com/NunoSempere/status/1831106442721452312), [here](https://x.com/NunoSempere/status/1829525844169248912), [here](https://x.com/NunoSempere/status/1818810770932568308), [here](https://x.com/NunoSempere/status/1816605190415401100), [here](https://x.com/NunoSempere/status/1816604386703081894), [here](https://x.com/NunoSempere/status/1815169781907042504) + ## Tips & tricks - It's conceptually clearer to have all the multiplications first and then all the divisions diff --git a/fermi.go b/fermi.go index c58401b..9650f33 100644 --- a/fermi.go +++ b/fermi.go @@ -73,7 +73,7 @@ const HELP_MSG = " Operation | Variable assignment | Special\n" + " beta: beta alpha beta\n" + " Variable assignment: =: variable_name\n" + " Variable assignment and clear stack: =. variable_name\n" + - " Special: \n" + + " Special commands: \n" + " Comment: # this is a comment\n" + " Clear stack: clear | c | .\n" + " Print debug info: debug | d\n" + @@ -209,8 +209,6 @@ func multiplyDists(old_dist Dist, new_dist Dist) (Dist, error) { return multiplyLogDists(o, n), nil case Scalar: return multiplyLogDists(o, Lognormal{low: float64(n), high: float64(n)}), nil - default: - return operateDistsAsSamples(old_dist, new_dist, "*") } } case Scalar: @@ -223,20 +221,15 @@ func multiplyDists(old_dist Dist, new_dist Dist) (Dist, error) { return multiplyLogDists(Lognormal{low: float64(o), high: float64(o)}, n), nil case Scalar: return Scalar(float64(o) * float64(n)), nil - default: - return operateDistsAsSamples(old_dist, new_dist, "*") } } case Beta: switch n := new_dist.(type) { case Beta: return multiplyBetaDists(o, n), nil - default: - return operateDistsAsSamples(old_dist, new_dist, "*") } - default: - return operateDistsAsSamples(old_dist, new_dist, "*") } + return operateDistsAsSamples(old_dist, new_dist, "*") } func divideDists(old_dist Dist, new_dist Dist) (Dist, error) {