Skip to content

Commit 5ad1e9f

Browse files
committed
get mathjax working
1 parent 589daae commit 5ad1e9f

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

_chapters/haskell1.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,11 @@ However, lazy by default sets Haskell apart. It has pros and cons; on the pro s
234234
But there are definitely cons:
235235

236236
- It can be hard to reason about runtime performance
237-
- Mixing up strict and lazy evaluation (which can happen inadvertently) can lead to (for example) O(n<sup>2</sup>) behaviour in what should be linear time processing.
237+
- Mixing up strict and lazy evaluation (which can happen inadvertently) can lead to (for example) $\mathcal{O}(n^2)$ behaviour in what should be linear time processing.
238238

239239
## Lazy infinite lists
240240

241-
Note that our "Hello world!" function to recursively compute the $n^{th}$ Fibonacci number [above](#starting-with-the-ghci-repl) was not at all efficient (in fact $O(2^n)$). We will now demonstrate a very idiomatic haskell construction for defining a lazy sequence of Fibonacci numbers that is linear time in the number of fibs required. In the following definition for `lazyFibs`, `zipWith` is a function which uses the specified function (in this case `(+)`) to pair the heads of two given lists. In this case, we are zipping over recursive references to `lazyFibs` and `tail lazyFibs`.
241+
Note that our "Hello world!" function to recursively compute the $n^\text{th}$ Fibonacci number [above](#starting-with-the-ghci-repl) was not at all efficient (in fact $\mathcal{O}(2^n)$). We will now demonstrate a very idiomatic haskell construction for defining a lazy sequence of Fibonacci numbers that is linear time in the number of fibs required. In the following definition for `lazyFibs`, `zipWith` is a function which uses the specified function (in this case `(+)`) to pair the heads of two given lists. In this case, we are zipping over recursive references to `lazyFibs` and `tail lazyFibs`.
242242

243243
```haskell
244244
lazyFibs = 1 : 1 : zipWith (+) lazyFibs (tail lazyFibs)

_includes/head.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,12 @@
1212

1313
{%- include custom-head.html -%}
1414

15+
<!-- MathJax v3 -->
16+
<script>
17+
window.MathJax = {
18+
tex: { inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }
19+
};
20+
</script>
21+
<script defer src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
22+
1523
</head>

_layouts/base.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
{%- include head.html -%}
55
<script src="{{ "/assets/js/spoilers.js" | relative_url }}" defer></script>
6-
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
76
<body>
87

98
{%- include header.html -%}

0 commit comments

Comments
 (0)