Compare commits

..

No commits in common. "a859f2572f611b590ee2c17007eb4a176e36837f" and "7ff3b2148e5abc8cdb872faa7d6c1bb680c40d50" have entirely different histories.

3 changed files with 3 additions and 10 deletions

View File

@ -1,6 +1,6 @@
# A minimalist calculator for fermi estimation # A minimalist calculator for fermi estimation
This project is a minimalist, calculator-style DSL for fermi estimation. It can multiply, divide, add and substract scalars, lognormals and beta distributions. This project is a minimalist, stack-based DSL for fermi estimation. It can multiply, divide, add and substract scalars, lognormals and beta distributions.
## Motivation ## Motivation
@ -120,7 +120,6 @@ help
- It's conceptually clearer to have all the multiplications first and then all the divisions - 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 - 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 ## Different levels of complexity
@ -162,7 +161,6 @@ Done:
To (possibly) do: To (possibly) do:
- [ ] Specify number of samples as a command line option
- [ ] Document parenthesis syntax - [ ] Document parenthesis syntax
- [ ] Add functions. Now easier to do with an explicit representation of the stakc - [ ] Add functions. Now easier to do with an explicit representation of the stakc
- [ ] Think about how to draw a histogram from samples - [ ] Think about how to draw a histogram from samples

3
f.go
View File

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

View File

@ -9,9 +9,3 @@ install: f
rm /usr/bin/f rm /usr/bin/f
sudo mv f /usr/bin/f sudo mv f /usr/bin/f
sudo ln -s /usr/bin/f /usr/bin/fermi 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