style changes

master
Rachel Lambda Samuelsson 2024-01-13 00:03:21 +01:00
parent fb5a8c3984
commit 1a2629f9e0
4 changed files with 58 additions and 44 deletions

View File

@ -55,7 +55,7 @@ f⁻¹ . f = id
we construct
```
```hs
f :: (a, Either b c) -> Either (a, b) (a, c)
f (a, Left b) = Left (a, b)
f (a, Right c) = Right (a, c)

View File

@ -5,7 +5,9 @@ layout: default
<header>
<nav><ul>
<li class="sitetitle">
<div class="titlecontainer">
<a class="bigger" href="/">rachel.cafe</a>
</div
</li>
</nav></ul>
<hr>

View File

@ -35,7 +35,7 @@ With this in mind, it might come as a surprise that there is a closed, non-recur
# Programmatically calculating the $$n$$-th Fibonacci number
A naive way of calculating the $$n$$-th Fibonacci number is to use the definition above. Check if $$n = 0$$, if $$n = 1$$, and otherwise calculating $$f_{n-2}$$ and $$f_{n-1}$$. This corresponds to the following Haskell code:
```
```hs
fib :: Integer -> Integer
fib 0 = 0
fib 1 = 1
@ -45,7 +45,7 @@ fib n = fib (n-2) + fib (n-1)
However, there is an issue with this method, many Fibonacci numbers will be calculated numerous times, as for each Fibonacci number evaluated we split into two paths, evaluating the previous and twice previous Fibonacci number. The reader which prefers visuals might appreciate Figure 1.5 from the SICP chapter.
How might we fix this then? A human calculating the $$n$$-th Fibonacci number might construct a list of Fibonacci numbers, calculating each Fibonacci number only once. While it is possible to do this on the computer it is superfluous to carry around all previous numbers, as we only need the previous two to calculate the next one. We might think of this as a 2-slot window, moving along the Fibonacci numbers, taking $$n$$ steps to arrive at $$f_n$$. In code we could represent this as follows:
```
```hs
-- steps -> f n-2 -> f n-1 -> f n
window :: Integer -> Integer -> Integer -> Integer
window 0 a b = a

View File

@ -8,13 +8,8 @@
body {
font-family: "SAX2";
background: #1d1f21;
background-image: url(/assets/img/bg.png);
background-repeat: repeat;
background-position: center;
color: #c5c8c6;
background: #FCEFDB;
color: black;
display: flex;
justify-content: center;
@ -76,8 +71,8 @@ a:hover {
color: #70c0b1;
}
.sitetitle a, {
color: #b55690;
.titlecontainer a {
font-size: 2em;
}
.sitetitle {
@ -87,6 +82,21 @@ a:hover {
justify-content: center;
}
.titlecontainer {
background-image: url(/assets/img/bg.png);
background-repeat: repeat;
background-position: center;
background-size: 10em;
padding-top: 4em;
padding-bottom: 4em;
margin-top: 2em;
margin-bottom: 2em;
width: 80%;
border-style: solid;
border-width: 5px;
border-color: #d54e53;
}
.right {
text-align: right;
float: right;
@ -108,31 +118,6 @@ a:hover {
max-width: 200%;
}
@media only screen and (max-width : 850px) {
.centercol {
box-sizing: border-box !important;
width: 100vw !important;
padding: 10px !important;
backdrop-filter: blur(4px) !important;
-webkit-backdrop-filter: blur(4px) !important;
box-shadow: none !important;
-webkit-box-shadow: none !important;
}
.aba {
display: flex;
flex-direction: column;
align-items: center;
justify-content: top;
}
.rimg {
margin: 1em 0 0 0;
width: 70%;
max-width: 70%;
}
}
.posts {
margin: 0;
@ -155,7 +140,6 @@ nav ul {
nav ul li {
display: inline;
margin-right: 1em;
white-space: nowrap;
}
@ -176,11 +160,11 @@ table {
width: 60em;
min-height: 100vh;
max-width: 94vw;
padding: 4em;
backdrop-filter: blur(7px);
-webkit-backdrop-filter: blur(7px);
box-shadow: 0 0 0 5px #d54e53;
-webkit-box-shadow: 0 0 0 5px #d54e53;
padding-left: 4em;
padding-right: 4em;
border-style: solid;
border-width: 0 5px;
border-color: #d54e53;
}
table {
@ -192,7 +176,6 @@ table {
margin-left: auto;
margin-right: auto;
margin-bottom: 1em;
filter: invert(1);
}
.cdfig {
@ -274,3 +257,32 @@ table {
.highlight .vg { color: #ebdbb2; background-color: #282828 } /* Name.Variable.Global */
.highlight .vi { color: #ebdbb2; background-color: #282828 } /* Name.Variable.Instance */
.highlight .il { color: #d3869b; background-color: #282828 } /* Literal.Number.Integer.Long */
@media only screen and (max-width : 850px) {
.centercol {
box-sizing: border-box;
width: 100vw;
max-width: 100vw;
padding-left: 2em;
padding-right: 2em;
border-style: none;
}
.titlecontainer {
width: 100%
}
.aba {
display: flex;
flex-direction: column;
align-items: center;
justify-content: top;
}
.rimg {
margin: 1em 0 0 0;
width: 70%;
max-width: 70%;
}
}