savepoint

This commit is contained in:
NunoSempere 2024-05-10 22:47:34 +01:00
parent 290be77204
commit 355ad371a7
2 changed files with 21 additions and 2 deletions

View File

@ -61,15 +61,30 @@ Why use make instead of the built-in go commands? Because the point of make is t
## Usage together with standard Linux utilities ## Usage together with standard Linux utilities
``` ```bash
f f
ed -u "s|#.*||" | sed -u 's|M|000000|g' | f sed -u "s|#.*||" | sed -u 's|M|000000|g' | f
cat more/piano-tuners.f | f cat more/piano-tuners.f | f
cat more/piano-tuners-commented.f | sed -u "s|#.*||" | sed -u 's|M|000000|g' | f cat more/piano-tuners-commented.f | sed -u "s|#.*||" | sed -u 's|M|000000|g' | f
tee -a input.log | go run f.go | tee -a output.log tee -a input.log | go run f.go | tee -a output.log
tee -a io.log | go run f.go | tee -a io.log tee -a io.log | go run f.go | tee -a io.log
function f(){
sed -u "s|#.*||" |
sed -u "s|//.*||" |
sed -u 's|K|000|g' |
sed -u 's|M|000000|g' |
sed -u 's|B|000000000|g' |
/usr/bin/f
}
``` ```
## Tips & tricks
Conceptually clearer to have all the multiplications first and then all the divisions
## Roadmap ## Roadmap
- [x] Write README - [x] Write README
@ -81,3 +96,5 @@ tee -a io.log | go run f.go | tee -a io.log
- [x] Add show more info version - [x] Add show more info version
- [ ] Program into a small device, like a calculator? - [ ] Program into a small device, like a calculator?
- [ ] Think of some way of calling bc - [ ] Think of some way of calling bc
- [ ] Think how to integrate with squiggle.c to draw samples
- [ ] Think about how to draw a histogram from samples

2
f.go
View File

@ -82,7 +82,9 @@ EventForLoop:
fmt.Printf("=> %.1f %.1f\n", old_low, old_high) fmt.Printf("=> %.1f %.1f\n", old_low, old_high)
logmean_old, logstd_old := boundsToLogParams(old_low, old_high) logmean_old, logstd_old := boundsToLogParams(old_low, old_high)
fmt.Printf("=> Lognormal, with logmean: %.1f, logstd: %.1f\n", logmean_old, logstd_old) fmt.Printf("=> Lognormal, with logmean: %.1f, logstd: %.1f\n", logmean_old, logstd_old)
continue EventForLoop
} }
fmt.Println(error_msg_cont)
continue EventForLoop continue EventForLoop
case 2: case 2:
new_low, err1 = strconv.ParseFloat(tokens[0], 64) new_low, err1 = strconv.ParseFloat(tokens[0], 64)