Add the work-in-progress Bergamot widget to the basics page.

This commit is contained in:
Danila Fedorin 2023-11-29 23:21:15 -08:00
parent 5041c90ac0
commit c25f9ad9ae

View File

@ -6,6 +6,9 @@ series: "Everything I Know About Types"
draft: true
---
{{< katex_component_js >}}
{{< bergamot_js_css >}}
It's finally time to start looking at types. As I mentioned, I want
to take an approach that draws a variety of examples from the real
world - I'd like to talk about examples from real programming
@ -436,3 +439,12 @@ and already be up-to-speed on a big chunk of the content.
| {{< latex >}}n : \text{number} {{< /latex >}}| Number literals have type \\(\\text{number}\\) |
| {{< latex >}}\frac{e_1 : \text{string}\quad e_2 : \text{string}}{e_1+e_2 : \text{string}} {{< /latex >}}| Adding strings gives a string |
| {{< latex >}}\frac{e_1 : \text{number}\quad e_2 : \text{number}}{e_1+e_2 : \text{number}} {{< /latex >}}| Adding numbers gives a number |
#### Playground
{{< bergamot_widget id="widget-one" query="" >}}
TInt @ type(intlit(?n), tint) <-;
TString @ type(strlit(?s), tstr) <-;
TPlusI @ type(plus(?e_1, ?e_2), tint) <- type(?e_1, tint), type(?e_2, tint);
TPlusS @ type(plus(?e_1, ?e_2), tstr) <- type(?e_1, tstr), type(?e_2, tstr);
{{< /bergamot_widget >}}