sets echo on by default with read from file flag
This commit is contained in:
parent
a99934387c
commit
27f9932db8
|
@ -4,7 +4,7 @@ This project is a minimalist, calculator-style DSL for fermi estimation. It can
|
||||||
|
|
||||||
## Motivation
|
## Motivation
|
||||||
|
|
||||||
Sometimes, [Squiggle](https://github.com/quantified-uncertainty/squiggle), [simple squiggle](https://git.nunosempere.com/quantified.uncertainty/simple-squiggle) or [squiggle.c](https://git.nunosempere.com/personal/squiggle.c) are still too complicated and un-unix-like.
|
Sometimes, [Squiggle](https://github.com/quantified-uncertainty/squiggle), [simple squiggle](https://git.nunosempere.com/quantified.uncertainty/simple-squiggle) or [squiggle.c](https://git.nunosempere.com/personal/squiggle.c) are still too complicated and un-unix-like. In particular, their startup cost is not instant.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ Command flags:
|
||||||
-echo
|
-echo
|
||||||
Specifies whether inputs should be echoed back. Useful if reading from a file
|
Specifies whether inputs should be echoed back. Useful if reading from a file
|
||||||
. -f string
|
. -f string
|
||||||
Specifies a file with a model to run
|
Specifies a file with a model to run. Sets the echo command to true by default.
|
||||||
-n int
|
-n int
|
||||||
Specifies the number of samples to draw when using samples (default 100000)
|
Specifies the number of samples to draw when using samples (default 100000)
|
||||||
-h Shows help message
|
-h Shows help message
|
||||||
|
@ -194,6 +194,7 @@ Done:
|
||||||
|
|
||||||
To (possibly) do:
|
To (possibly) do:
|
||||||
|
|
||||||
|
- [ ] With the -f command line option, the program doesn't read from stdin after finishing reading the file
|
||||||
- [ ] 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
|
||||||
- [ ] Dump samples to file
|
- [ ] Dump samples to file
|
||||||
|
|
3
fermi.go
3
fermi.go
|
@ -459,7 +459,7 @@ replForLoop:
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
num_samples_flag := flag.Int("n", N_SAMPLES, "Specifies the number of samples to draw when using samples")
|
num_samples_flag := flag.Int("n", N_SAMPLES, "Specifies the number of samples to draw when using samples")
|
||||||
filename := flag.String("f", "", "Specifies a file with a model to run")
|
filename := flag.String("f", "", "Specifies a file with a model to run. Sets the echo flag to true")
|
||||||
echo_flag := flag.Bool("echo", false, "Specifies whether inputs should be echoed back. Useful if reading from a file.")
|
echo_flag := flag.Bool("echo", false, "Specifies whether inputs should be echoed back. Useful if reading from a file.")
|
||||||
help_flag := flag.Bool("h", false, "Shows help message")
|
help_flag := flag.Bool("h", false, "Shows help message")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
@ -472,6 +472,7 @@ func main() {
|
||||||
if *filename != "" {
|
if *filename != "" {
|
||||||
file, err := os.Open(*filename)
|
file, err := os.Open(*filename)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
*echo_flag = true
|
||||||
reader = bufio.NewReader(file)
|
reader = bufio.NewReader(file)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("Error opening filename; reading from stdin instead\n")
|
fmt.Printf("Error opening filename; reading from stdin instead\n")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user