Skip to content

Commit

Permalink
deploy: 3cd13b3
Browse files Browse the repository at this point in the history
  • Loading branch information
noelwelsh committed Aug 29, 2024
1 parent 3e68124 commit f16c11a
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 36 deletions.
8 changes: 4 additions & 4 deletions 2-explore/initial.html
Original file line number Diff line number Diff line change
Expand Up @@ -469,18 +469,18 @@ <h4 id="exercise-shall-i-compare-thee-to-a-summer-s-day">Exercise: Shall I compa
<div class="exercise">

<h4 id="exercise-statistics-is-the-grammar-of-science">Exercise: Statistics is the Grammar of Science</h4>
<p>Can you think of other ways we could analyse the data, apart from extracting data by decade and visualizing it? This is an open-ended question; any answers are good answers!</p>
<p>Can you think of other ways we could analyse the data to see if there is a difference in temperature over time, apart from extracting data by decade and visualizing it? This is an open-ended question; any answers are good answers!</p>
</div>
<div class="solution">
<div class="solution-body">
<p>There are no right and wrong answers to this, but the more you&#39;ve studied statistics the more answers (and the more complex those answers) are likely to.</p>
<p>Here are some ideas:</p>
<p>Here are just a few ideas:</p>
<ul>
<li>
<p>We could try looking at differences between, say, the first 50 years and the last 50 years of data in the data set</p>
<p>The main data point is the divergence from the baseline of 1961-1990. So perhaps we could sum the divergences before that period and compare them to the sum of divergences after that baseline? We could also compute sums by month, and compare those, if we suspect the divergence changes by month.</p>
</li>
<li>
<p>We could try to </p>
<p>As a variation on the above idea</p>
</li>
</ul>
</div>
Expand Down
10 changes: 5 additions & 5 deletions animation/easing.html
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,12 @@ <h1 id="easing-functions" class="title">Easing Functions</h1>
.</span><span class="identifier">withRender</span><span>(</span><span class="identifier">r</span><span> =&gt; </span><span class="type-name">Image</span><span>.</span><span class="identifier">circle</span><span>(</span><span class="identifier">r</span><span>))
</span><span class="comment">// bubble: Reactor[Double] = Reactor(
// initial = 0.0,
// onMouseClickHandler = doodle.reactor.Reactor$$$Lambda$14695/0x00000001039a4840@36c35d3c,
// onMouseMoveHandler = doodle.reactor.Reactor$$$Lambda$14696/0x00000001039a5840@20035558,
// onTickHandler = doodle.reactor.Reactor$$$Lambda$14700/0x00000001039b0840@7edc77d5,
// onMouseClickHandler = doodle.reactor.Reactor$$$Lambda$13877/0x00000001037bd840@4cef0c,
// onMouseMoveHandler = doodle.reactor.Reactor$$$Lambda$13878/0x00000001037be040@67973fb5,
// onTickHandler = doodle.reactor.Reactor$$$Lambda$13882/0x00000001037c7040@226c56f,
// tickRate = 100 milliseconds,
// renderHandler = repl.MdocSession$MdocApp$$Lambda$14702/0x00000001039b2840@92ad074,
// stopHandler = doodle.reactor.Reactor$$$Lambda$14701/0x00000001039b1840@25ac46d0
// renderHandler = repl.MdocSession$MdocApp$$Lambda$13884/0x00000001037c5840@241dd226,
// stopHandler = doodle.reactor.Reactor$$$Lambda$13883/0x00000001037c6040@434e6d26
// )</span></code></pre>
<div class="flex flex-row justify-between">
<a class="pageNavigation" href="../sequences/">←Shapes, Sequences, and Stars</a> <a class="pageNavigation" href="reactor.html">Reactors→</a>
Expand Down
6 changes: 3 additions & 3 deletions flowers/functions.html
Original file line number Diff line number Diff line change
Expand Up @@ -498,17 +498,17 @@ <h4 id="exercise-function-literals">Exercise: Function Literals</h4>
<div class="solution-body">
<p>The first function is</p>
<pre><code class="nohighlight"><span>(</span><span class="identifier">x</span><span>: </span><span class="type-name">Int</span><span>) =&gt; </span><span class="identifier">x</span><span> * </span><span class="identifier">x</span><span>
</span><span class="comment">// res10: Function1[Int, Int] = repl.MdocSession$MdocApp0$$Lambda$15005/0x0000000103a50840@45554032</span></code></pre>
</span><span class="comment">// res10: Function1[Int, Int] = repl.MdocSession$MdocApp0$$Lambda$14187/0x00000001038b0840@7c2bbd90</span></code></pre>
<p>The second is</p>
<pre><code class="nohighlight"><span>(</span><span class="identifier">c</span><span>: </span><span class="type-name">Color</span><span>) =&gt; </span><span class="identifier">c</span><span>.</span><span class="identifier">spin</span><span>(</span><span class="number-literal">15</span><span>.</span><span class="identifier">degrees</span><span>)
</span><span class="comment">// res11: Function1[Color, HSLA] = repl.MdocSession$MdocApp0$$Lambda$15006/0x0000000103ab6840@64c98b56</span></code></pre>
</span><span class="comment">// res11: Function1[Color, HSLA] = repl.MdocSession$MdocApp0$$Lambda$14188/0x00000001038c0040@7046a5e0</span></code></pre>
<p>The third is</p>
<pre><code class="nohighlight"><span>(</span><span class="identifier">image</span><span>: </span><span class="type-name">Image</span><span>) =&gt;
</span><span class="identifier">image</span><span>.</span><span class="identifier">beside</span><span>(</span><span class="identifier">image</span><span>.</span><span class="identifier">rotate</span><span>(</span><span class="number-literal">90</span><span>.</span><span class="identifier">degrees</span><span>))
.</span><span class="identifier">beside</span><span>(</span><span class="identifier">image</span><span>.</span><span class="identifier">rotate</span><span>(</span><span class="number-literal">180</span><span>.</span><span class="identifier">degrees</span><span>))
.</span><span class="identifier">beside</span><span>(</span><span class="identifier">image</span><span>.</span><span class="identifier">rotate</span><span>(</span><span class="number-literal">270</span><span>.</span><span class="identifier">degrees</span><span>))
.</span><span class="identifier">beside</span><span>(</span><span class="identifier">image</span><span>.</span><span class="identifier">rotate</span><span>(</span><span class="number-literal">360</span><span>.</span><span class="identifier">degrees</span><span>))
</span><span class="comment">// res12: Function1[Image, Image] = repl.MdocSession$MdocApp0$$Lambda$15007/0x0000000103ab7040@6a144455</span></code></pre>
</span><span class="comment">// res12: Function1[Image, Image] = repl.MdocSession$MdocApp0$$Lambda$14189/0x00000001038c1040@2490c31</span></code></pre>
</div>
</div>
<div class="exercise">
Expand Down
16 changes: 8 additions & 8 deletions generative/flatmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -499,15 +499,15 @@ <h4 id="randomness-and-randomness" class="section">Randomness and Randomness {-}
// c = FlatMapped(
// c = FlatMapped(
// c = Suspend(a = RDouble),
// f = cats.free.Free$$Lambda$15084/0x0000000103ade840@b09bc23
// f = cats.free.Free$$Lambda$14266/0x00000001038f5840@4da234c0
// ),
// f = cats.free.Free$$Lambda$15084/0x0000000103ade840@5e88d1aa
// f = cats.free.Free$$Lambda$14266/0x00000001038f5840@5930705a
// ),
// f = cats.free.Free$$Lambda$15084/0x0000000103ade840@3e41b7ac
// f = cats.free.Free$$Lambda$14266/0x00000001038f5840@10b1d7e8
// ),
// f = repl.MdocSession$MdocApp5$$Lambda$15101/0x0000000103ae5040@b33a04a
// f = repl.MdocSession$MdocApp5$$Lambda$14283/0x0000000103905040@169ad7a7
// ),
// f = repl.MdocSession$MdocApp5$$Lambda$15104/0x0000000103a44840@4d9dfdab
// f = repl.MdocSession$MdocApp5$$Lambda$14286/0x0000000103910840@4a42e580
// )</span></code></pre>
<p>which makes it clearer that we&#39;re generating three different circles.
&lt;/div&gt;</p>
Expand All @@ -528,17 +528,17 @@ <h4 id="colored-boxes" class="section">Colored Boxes {-}</h4>
</span><span class="type-name">Random</span><span>.</span><span class="identifier">double</span><span>.</span><span class="identifier">map</span><span>(</span><span class="identifier">x</span><span> =&gt; </span><span class="identifier">x</span><span>.</span><span class="identifier">turns</span><span>)
</span><span class="comment">// randomAngle: Free[[A &gt;: Nothing &lt;: Any] =&gt; RandomOp[A], Angle] = FlatMapped(
// c = Suspend(a = RDouble),
// f = cats.free.Free$$Lambda$15084/0x0000000103ade840@55006033
// f = cats.free.Free$$Lambda$14266/0x00000001038f5840@10aaee32
// )
</span><span>
</span><span class="keyword">val</span><span> </span><span class="identifier">randomColor</span><span>: </span><span class="type-name">Random</span><span>[</span><span class="type-name">Color</span><span>] =
</span><span class="identifier">randomAngle</span><span>.</span><span class="identifier">map</span><span>(</span><span class="identifier">hue</span><span> =&gt; </span><span class="type-name">Color</span><span>.</span><span class="identifier">hsl</span><span>(</span><span class="identifier">hue</span><span>, </span><span class="number-literal">0.7</span><span>, </span><span class="number-literal">0.7</span><span>))
</span><span class="comment">// randomColor: Free[[A &gt;: Nothing &lt;: Any] =&gt; RandomOp[A], Color] = FlatMapped(
// c = FlatMapped(
// c = Suspend(a = RDouble),
// f = cats.free.Free$$Lambda$15084/0x0000000103ade840@55006033
// f = cats.free.Free$$Lambda$14266/0x00000001038f5840@10aaee32
// ),
// f = cats.free.Free$$Lambda$15084/0x0000000103ade840@66cf41e8
// f = cats.free.Free$$Lambda$14266/0x00000001038f5840@e3a6558
// )
</span><span>
</span><span class="keyword">def</span><span> </span><span class="declaration-name">coloredRectangle</span><span>(</span><span class="identifier">color</span><span>: </span><span class="type-name">Color</span><span>): </span><span class="type-name">Image</span><span> =
Expand Down
16 changes: 8 additions & 8 deletions generative/generative.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,29 +343,29 @@ <h1 id="generative-art" class="title">Generative Art</h1>
</tbody>
</table>
<pre><code class="nohighlight"><span class="identifier">math</span><span>.</span><span class="identifier">random</span><span>
</span><span class="comment">// res0: Double = 0.9168565441489642
</span><span class="comment">// res0: Double = 0.6427896086532323
</span><span class="identifier">math</span><span>.</span><span class="identifier">random</span><span>
</span><span class="comment">// res1: Double = 0.014025398499650121</span></code></pre>
</span><span class="comment">// res1: Double = 0.7087462840661014</span></code></pre>
<p>Given <code>math.random</code> we could produce a method that returns a random <code>Angle</code> like so.</p>
<pre><code class="nohighlight"><span class="keyword">def</span><span> </span><span class="declaration-name">randomAngle</span><span>: </span><span class="type-name">Angle</span><span> =
</span><span class="identifier">math</span><span>.</span><span class="identifier">random</span><span>.</span><span class="identifier">turns</span><span>

</span><span class="identifier">randomAngle</span><span>
</span><span class="comment">// res2: Angle = Angle(4.496679510477112)
</span><span class="comment">// res2: Angle = Angle(0.22100981710708745)
</span><span class="identifier">randomAngle</span><span>
</span><span class="comment">// res3: Angle = Angle(1.091749901378329)</span></code></pre>
</span><span class="comment">// res3: Angle = Angle(2.8733864313204065)</span></code></pre>
<p>Why might we not want to do this? What principle does this break?</p>
<p>&lt;div class=&quot;solution&quot;&gt;
Generating random numbers in this way breaks substitution. Remember substitution says wherever we see an expression we should be able to substitute the value it evaluates to without changing the meaning of the program. Concretely, this means</p>
<pre><code class="nohighlight"><span class="keyword">val</span><span> </span><span class="identifier">result1</span><span> = </span><span class="identifier">randomAngle</span><span>
</span><span class="comment">// result1: Angle = Angle(3.3916689967169824)
</span><span class="comment">// result1: Angle = Angle(3.3579227342350033)
</span><span class="keyword">val</span><span> </span><span class="identifier">result2</span><span> = </span><span class="identifier">randomAngle</span><span>
</span><span class="comment">// result2: Angle = Angle(1.6392502769140465)</span></code></pre>
</span><span class="comment">// result2: Angle = Angle(4.3455812866304795)</span></code></pre>
<p>and </p>
<pre><code class="nohighlight"><span class="keyword">val</span><span> </span><span class="identifier">result1</span><span> = </span><span class="identifier">randomAngle</span><span>
</span><span class="comment">// result1: Angle = Angle(5.150033527619064)
</span><span class="comment">// result1: Angle = Angle(1.4581806912472342)
</span><span class="keyword">val</span><span> </span><span class="identifier">result2</span><span> = </span><span class="identifier">result1</span><span>
</span><span class="comment">// result2: Angle = Angle(5.150033527619064)</span></code></pre>
</span><span class="comment">// result2: Angle = Angle(1.4581806912472342)</span></code></pre>
<p>should be the same program and clearly they are not.
&lt;/div&gt;</p>
<p>What should we do? Suffer the slings and arrows of outrageous computational models, or take arms against a sea of side-effects, and by opposing end them! There&#39;s really only one choice.</p>
Expand Down
6 changes: 3 additions & 3 deletions generative/random.html
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ <h1 id="randomness-without-effect" class="title">Randomness without Effect</h1>
// )</span></code></pre>
<p>No random numbers are actually created until we call the <code>run</code> method.</p>
<pre><code class="nohighlight"><span class="identifier">randomDouble</span><span>.</span><span class="identifier">run</span><span>
</span><span class="comment">// res0: Double = 0.6391922592328213</span></code></pre>
</span><span class="comment">// res0: Double = 0.3819358644150743</span></code></pre>
<p>The type <code>Random[Double]</code> indicates we have something that will produce a random <code>Double</code> when we <code>run</code> it. Just like with <code>Image</code> and <code>draw</code>, substitution holds with <code>Random</code> up until the point we call <code>run</code>.</p>
<p>Table Table generative:random shows some of the ways to construct <code>Random</code> values.</p>
<hr>
Expand Down Expand Up @@ -366,9 +366,9 @@ <h3 id="composing-random" class="section">Composing Random</h3>
</span><span class="type-name">Random</span><span>.</span><span class="identifier">double</span><span>.</span><span class="identifier">map</span><span>(</span><span class="identifier">x</span><span> =&gt; </span><span class="identifier">x</span><span>.</span><span class="identifier">turns</span><span>)</span></code></pre>
<p>When we <code>run</code> <code>RandomAngle</code> we can generate randomly created <code>Angle</code></p>
<pre><code class="nohighlight"><span class="identifier">randomAngle</span><span>.</span><span class="identifier">run</span><span>
</span><span class="comment">// res1: Angle = Angle(1.2997647128358922)
</span><span class="comment">// res1: Angle = Angle(5.377266716596994)
</span><span class="identifier">randomAngle</span><span>.</span><span class="identifier">run</span><span>
</span><span class="comment">// res2: Angle = Angle(5.0484024376037295)</span></code></pre>
</span><span class="comment">// res2: Angle = Angle(3.0049676253204924)</span></code></pre>

<h3 id="exercises" class="section">Exercises {-}</h3>

Expand Down
8 changes: 4 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13532,10 +13532,6 @@ $c_Lpolygons_Polygons$.prototype.polygonPointsExercise__T__V = (function(id) {
var this$11 = $m_Ldoodle_image_syntax_package$all$();
new $c_Ldoodle_image_syntax_AbstractImageSyntax$ImageOps(this$11, image).drawWithFrame__O__Ldoodle_effect_Renderer__Lcats_effect_unsafe_IORuntime__V($n($m_Ldoodle_svg_package$().Ldoodle_svg_package$__f_Frame).apply__T__Ldoodle_svg_effect_Frame(id), $m_Ldoodle_svg_package$().Ldoodle_svg_package$__f_svgRenderer, $m_Lcats_effect_unsafe_IORuntime$().global__Lcats_effect_unsafe_IORuntime());
});
$c_Lpolygons_Polygons$.prototype.polygonPointsExercise = (function(arg) {
var prep0 = $as_T(arg);
this.polygonPointsExercise__T__V(prep0);
});
$c_Lpolygons_Polygons$.prototype.vertices = (function(arg) {
var prep0 = $as_T(arg);
this.vertices__T__V(prep0);
Expand All @@ -13544,6 +13540,10 @@ $c_Lpolygons_Polygons$.prototype.points = (function(arg) {
var prep0 = $as_T(arg);
this.points__T__V(prep0);
});
$c_Lpolygons_Polygons$.prototype.polygonPointsExercise = (function(arg) {
var prep0 = $as_T(arg);
this.polygonPointsExercise__T__V(prep0);
});
var $d_Lpolygons_Polygons$ = new $TypeData().initClass($c_Lpolygons_Polygons$, "polygons.Polygons$", ({
Lpolygons_Polygons$: 1
}));
Expand Down
2 changes: 1 addition & 1 deletion main.js.map

Large diffs are not rendered by default.

0 comments on commit f16c11a

Please sign in to comment.