You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/src/example-factorial.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
<!-- This file is autogenerated! Do not modify it -->
2
2
3
3
# Factorial
4
-
<ahref="https://numbat.dev/?q=%23+Naive+factorial+implementation+to+showcase+recursive%0A%23+functions+and+conditionals.%0A%0Afn+factorial%28n%3A+Scalar%29+-%3E+Scalar+%3D%0A++if+n+%3C+1%0A++++then+1%0A++++else+n+%C3%97+factorial%28n+-+1%29%0A%0A%23+Compare+result+with+the+builtin+factorial+operator%0Aassert_eq%28factorial%2810%29%2C+10%21%29%0A"><iclass="fa fa-play"></i> Run this example</a>
4
+
<ahref="https://numbat.dev/?q=%23+Naive+factorial+implementation+to+showcase+recursive%0A%23+functions+and+conditionals.%0A%0Afn+factorial%28n%29+%3D%0A++if+n+%3C+1%0A++++then+1%0A++++else+n+%C3%97+factorial%28n+-+1%29%0A%0A%23+Compare+result+with+the+builtin+factorial+operator%0Aassert_eq%28factorial%2810%29%2C+10%21%29%0A"><iclass="fa fa-play"></i> Run this example</a>
5
5
6
6
```numbat
7
7
# Naive factorial implementation to showcase recursive
Copy file name to clipboardExpand all lines: book/src/example-population_growth.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
<!-- This file is autogenerated! Do not modify it -->
2
2
3
3
# Population growth
4
-
<ahref="https://numbat.dev/?q=%23+Exponential+model+for+population+growth%0A%0Alet+initial_population+%3D+50_000+people%0Alet+growth_rate+%3D+2%25+per+year%0A%0Afn+predict_population%28t%3A+Time%29+%3D%0A++++initial_population+%C3%97+e%5E%28growth_rate%C2%B7t%29+%7C%3E+round%0A%0Aprint%28%22Population+in++20+years%3A+%7Bpredict_population%2820+years%29%7D%22%29%0Aprint%28%22Population+in+100+years%3A+%7Bpredict_population%281+century%29%7D%22%29%0A"><iclass="fa fa-play"></i> Run this example</a>
4
+
<ahref="https://numbat.dev/?q=%23+Exponential+model+for+population+growth%0A%0Alet+initial_population+%3D+50_000+people%0Alet+growth_rate+%3D+2%25+per+year%0A%0Afn+predict_population%28t%29+%3D%0A++++initial_population+%C3%97+e%5E%28growth_rate%C2%B7t%29+%7C%3E+round%0A%0Aprint%28%22Population+in++20+years%3A+%7Bpredict_population%2820+years%29%7D%22%29%0Aprint%28%22Population+in+100+years%3A+%7Bpredict_population%281+century%29%7D%22%29%0A"><iclass="fa fa-play"></i> Run this example</a>
5
5
6
6
```numbat
7
7
# Exponential model for population growth
8
8
9
9
let initial_population = 50_000 people
10
10
let growth_rate = 2% per year
11
11
12
-
fn predict_population(t: Time) =
12
+
fn predict_population(t) =
13
13
initial_population × e^(growth_rate·t) |> round
14
14
15
15
print("Population in 20 years: {predict_population(20 years)}")
Copy file name to clipboardExpand all lines: book/src/example-xkcd_2585.md
+24-24Lines changed: 24 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
<!-- This file is autogenerated! Do not modify it -->
2
2
3
3
# XKCD 2585
4
-
<a href="https://numbat.dev/?q=%23+Rounding%0A%23%0A%23+https%3A%2F%2Fxkcd.com%2F2585%2F%0A%0A17+mph%0A%0Aans+-%3E+meters%2Fsec++++%7C%3E+round%0Aans+-%3E+knots+++++++++%7C%3E+round%0Aans+-%3E+fathoms%2Fsec+++%7C%3E+round%0Aans+-%3E+furlongs%2Fmin++%7C%3E+round%0Aans+-%3E+fathoms%2Fsec+++%7C%3E+round%0Aans+-%3E+kph+++++++++++%7C%3E+round%0Aans+-%3E+knots+++++++++%7C%3E+round%0Aans+-%3E+kph+++++++++++%7C%3E+round%0Aans+-%3E+furlongs%2Fhour+%7C%3E+round%0Aans+-%3E+mph+++++++++++%7C%3E+round%0Aans+-%3E+m%2Fs+++++++++++%7C%3E+round%0Aans+-%3E+furlongs%2Fmin++%7C%3E+round%0Aans+-%3E+yards%2Fsec+++++%7C%3E+round%0Aans+-%3E+fathoms%2Fsec+++%7C%3E+round%0Aans+-%3E+m%2Fs+++++++++++%7C%3E+round%0Aans+-%3E+mph+++++++++++%7C%3E+round%0Aans+-%3E+furlongs%2Fmin++%7C%3E+round%0Aans+-%3E+knots+++++++++%7C%3E+round%0Aans+-%3E+yards%2Fsec+++++%7C%3E+round%0Aans+-%3E+fathoms%2Fsec+++%7C%3E+round%0Aans+-%3E+knots+++++++++%7C%3E+round%0Aans+-%3E+furlongs%2Fmin++%7C%3E+round%0Aans+-%3E+mph+++++++++++%7C%3E+round%0A%0Aprint%28%22I+can+ride+my+bike+at+%7Bans%7D.%22%29%0Aprint%28%22If+you+round.%22%29%0A"><i class="fa fa-play"></i> Run this example</a>
4
+
<a href="https://numbat.dev/?q=%23+Rounding%0A%23%0A%23+https%3A%2F%2Fxkcd.com%2F2585%2F%0A%0A17+mph%0A%0Aans+-%3E+meters%2Fsec++++-%3E+round%0Aans+-%3E+knots+++++++++-%3E+round%0Aans+-%3E+fathoms%2Fsec+++-%3E+round%0Aans+-%3E+furlongs%2Fmin++-%3E+round%0Aans+-%3E+fathoms%2Fsec+++-%3E+round%0Aans+-%3E+kph+++++++++++-%3E+round%0Aans+-%3E+knots+++++++++-%3E+round%0Aans+-%3E+kph+++++++++++-%3E+round%0Aans+-%3E+furlongs%2Fhour+-%3E+round%0Aans+-%3E+mph+++++++++++-%3E+round%0Aans+-%3E+m%2Fs+++++++++++-%3E+round%0Aans+-%3E+furlongs%2Fmin++-%3E+round%0Aans+-%3E+yards%2Fsec+++++-%3E+round%0Aans+-%3E+fathoms%2Fsec+++-%3E+round%0Aans+-%3E+m%2Fs+++++++++++-%3E+round%0Aans+-%3E+mph+++++++++++-%3E+round%0Aans+-%3E+furlongs%2Fmin++-%3E+round%0Aans+-%3E+knots+++++++++-%3E+round%0Aans+-%3E+yards%2Fsec+++++-%3E+round%0Aans+-%3E+fathoms%2Fsec+++-%3E+round%0Aans+-%3E+knots+++++++++-%3E+round%0Aans+-%3E+furlongs%2Fmin++-%3E+round%0Aans+-%3E+mph+++++++++++-%3E+round%0A%0Aprint%28%22I+can+ride+my+bike+at+%7Bans%7D.%22%29%0Aprint%28%22If+you+round.%22%29%0A"><i class="fa fa-play"></i> Run this example</a>
Copy file name to clipboardExpand all lines: book/src/example-xkcd_2812.md
+1-3Lines changed: 1 addition & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
<!-- This file is autogenerated! Do not modify it -->
2
2
3
3
# XKCD 2812
4
-
<a href="https://numbat.dev/?q=%23+Solar+panel+placement%0A%23%0A%23+Solar+energy+tip%3A+To+maximize+sun+exposure%2C+always%0A%23+orient+your+panels+downward+and+install+them+on+the%0A%23+surface+of+the+sun.%0A%23%0A%23+https%3A%2F%2Fxkcd.com%2F2812%2F%0A%23%0A%23+%5B1%5D+https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FSolar_luminosity%0A%23+%5B2%5D+https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FSun%0A%0Aunit+%24%3A+Money%0A%0Alet+net_metering_rate+%3D+%24+0.20+%2F+kWh%0Alet+panel_area+%3D+1+m%C2%B2%0Alet+panel_efficiency+%3D+20+%25%0A%0Afn+savings%28i%3A+Irradiance%29+-%3E+Money+%2F+Time+%3D%0A++++net_metering_rate+%C3%97+i+%C3%97+panel_area+%C3%97+panel_efficiency+-%3E+%24%2Fyear%0A%0Aprint%28%22Option+A%3A+On+the+roof%2C+south+facing%22%29%0A%0Alet+savings_a+%3D+savings%284+kWh%2Fm%C2%B2%2Fday%29%0A%0Aprint%28savings_a+%7C%3E+round%29%0A%0Aprint%28%29%0Aprint%28%22Option+B%3A+On+the+sun%2C+downward+facing%22%29%0A%0Adimension+Luminosity+%3D+Power%0A%0Alet+sun_luminosity%3A+Luminosity+%3D+3.828e26+W++%23+%5B1%5D%0Alet+sun_area%3A+Area+%3D+6.09e12+km%5E2++++++++++++%23+%5B2%5D%0A%0Alet+savings_b+%3D+savings%28sun_luminosity+%2F+sun_area%29%0A%0Aprint%28savings_b+%7C%3E+round%29%0A"><i class="fa fa-play"></i> Run this example</a>
4
+
<a href="https://numbat.dev/?q=%23+Solar+panel+placement%0A%23%0A%23+Solar+energy+tip%3A+To+maximize+sun+exposure%2C+always%0A%23+orient+your+panels+downward+and+install+them+on+the%0A%23+surface+of+the+sun.%0A%23%0A%23+https%3A%2F%2Fxkcd.com%2F2812%2F%0A%23%0A%23+%5B1%5D+https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FSolar_luminosity%0A%23+%5B2%5D+https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FSun%0A%0Alet+net_metering_rate+%3D+%24+0.20+%2F+kWh%0Alet+panel_area+%3D+1+m%C2%B2%0Alet+panel_efficiency+%3D+20+%25%0A%0Afn+savings%28i%3A+Irradiance%29+-%3E+Money+%2F+Time+%3D%0A++++net_metering_rate+%C3%97+i+%C3%97+panel_area+%C3%97+panel_efficiency+-%3E+%24%2Fyear%0A%0Aprint%28%22Option+A%3A+On+the+roof%2C+south+facing%22%29%0A%0Alet+savings_a+%3D+savings%284+kWh%2Fm%C2%B2%2Fday%29%0A%0Aprint%28savings_a+%7C%3E+round%29%0A%0Aprint%28%29%0Aprint%28%22Option+B%3A+On+the+sun%2C+downward+facing%22%29%0A%0Adimension+Luminosity+%3D+Power%0A%0Alet+sun_luminosity%3A+Luminosity+%3D+3.828e26+W++%23+%5B1%5D%0Alet+sun_area%3A+Area+%3D+6.09e12+km%5E2++++++++++++%23+%5B2%5D%0A%0Alet+savings_b+%3D+savings%28sun_luminosity+%2F+sun_area%29%0A%0Aprint%28savings_b+%7C%3E+round%29%0A"><i class="fa fa-play"></i> Run this example</a>
0 commit comments