Compare commits

...

6 Commits

3 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,6 @@
# A minimalist calculator for fermi estimation
This project is a minimalist, stack-based DSL for fermi estimation. It can multiply, divide, add and substract scalars, lognormals and beta distributions.
This project is a minimalist, calculator-style DSL for fermi estimation. It can multiply, divide, add and substract scalars, lognormals and beta distributions.
## Motivation
@ -120,6 +120,7 @@ help
- It's conceptually clearer to have all the multiplications first and then all the divisions
- For things between 0 and 1, consider using a beta distribution
- Because the model reads from standard input, you can pipe a model to it. For instance, try cat more/piano-tuners.f | fermi
## Different levels of complexity
@ -161,6 +162,7 @@ Done:
To (possibly) do:
- [ ] Specify number of samples as a command line option
- [ ] Document parenthesis syntax
- [ ] Add functions. Now easier to do with an explicit representation of the stakc
- [ ] Think about how to draw a histogram from samples

3
f.go
View File

@ -364,6 +364,7 @@ replForLoop:
switch {
case strings.TrimSpace(new_line_trimmed) == "": /* Empty line case */
continue replForLoop
/* Parenthesis */
case len(words) == 2 && (words[0] == "*" || words[0] == "+" || words[0] == "-" || words[0] == "/") && words[1] == "(":
new_stack := runRepl(Stack{old_dist: INIT_DIST, vars: stack.vars}, reader)
@ -392,8 +393,6 @@ replForLoop:
fmt.Printf("%s ", words[1])
prettyPrintDist(stack.old_dist)
stack.old_dist = INIT_DIST
// fmt.Println()
// continue replForLoop
default:
op, new_dist, err := parseWordsIntoOpAndDist(words, stack.vars)
if err != nil {

View File

@ -9,3 +9,9 @@ install: f
rm /usr/bin/f
sudo mv f /usr/bin/f
sudo ln -s /usr/bin/f /usr/bin/fermi
install_xl: f
rm /usr/bin/fermixl
rm /usr/bin/fxl
sudo mv f /usr/bin/fxl
sudo ln -s /usr/bin/fxl /usr/bin/fermixl