Skip to content

Commit

Permalink
deploy: b5b1457
Browse files Browse the repository at this point in the history
  • Loading branch information
noelwelsh committed Jul 1, 2023
1 parent 7c7210d commit 2031596
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 37 deletions.
10 changes: 5 additions & 5 deletions animation/easing.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,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$13905/0x0000000103b96040@5b68389a,
// onMouseMoveHandler = doodle.reactor.Reactor$$$Lambda$13906/0x0000000103b97040@357b3afd,
// onTickHandler = doodle.reactor.Reactor$$$Lambda$13910/0x0000000103b9f040@5ec860c4,
// onMouseClickHandler = doodle.reactor.Reactor$$$Lambda$13906/0x0000000103b9e840@32ac8f0e,
// onMouseMoveHandler = doodle.reactor.Reactor$$$Lambda$13907/0x0000000103b9f040@46b0c52a,
// onTickHandler = doodle.reactor.Reactor$$$Lambda$13911/0x0000000103ba7040@2f5a262f,
// tickRate = 100 milliseconds,
// renderHandler = repl.MdocSession$MdocApp$$Lambda$13912/0x0000000103b9d040@4599a071,
// stopHandler = doodle.reactor.Reactor$$$Lambda$13911/0x0000000103b9e040@aa11be6
// renderHandler = repl.MdocSession$MdocApp$$Lambda$13913/0x0000000103ba5840@7267ddb8,
// stopHandler = doodle.reactor.Reactor$$$Lambda$13912/0x0000000103ba6040@59201e18
// )</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 @@ -346,17 +346,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$14233/0x0000000103cb5040@38c625ac</span></code></pre>
</span><span class="comment">// res10: Function1[Int, Int] = repl.MdocSession$MdocApp0$$Lambda$14234/0x0000000103cc2840@4bd3541e</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$14234/0x0000000103cb4840@4c752fad</span></code></pre>
</span><span class="comment">// res11: Function1[Color, HSLA] = repl.MdocSession$MdocApp0$$Lambda$14235/0x0000000103cc3840@6b17fa97</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$14235/0x0000000103cb3840@4da27275</span></code></pre>
</span><span class="comment">// res12: Function1[Image, Image] = repl.MdocSession$MdocApp0$$Lambda$14236/0x0000000103cc4040@3d0f6006</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 @@ -355,15 +355,15 @@ <h4 id="randomness-and-randomness" class="section">Randomness and Randomness {-}
// c = FlatMapped(
// c = FlatMapped(
// c = Suspend(a = RDouble),
// f = cats.free.Free$$Lambda$14296/0x0000000103cd4840@5250c06d
// f = cats.free.Free$$Lambda$14297/0x0000000103ce0840@31df7974
// ),
// f = cats.free.Free$$Lambda$14296/0x0000000103cd4840@485cf614
// f = cats.free.Free$$Lambda$14297/0x0000000103ce0840@5782fd34
// ),
// f = cats.free.Free$$Lambda$14296/0x0000000103cd4840@4a6cff9a
// f = cats.free.Free$$Lambda$14297/0x0000000103ce0840@674aa9df
// ),
// f = repl.MdocSession$MdocApp5$$Lambda$14313/0x0000000103cdd040@52ffa2a3
// f = repl.MdocSession$MdocApp5$$Lambda$14314/0x0000000103ce9840@4841d6fe
// ),
// f = repl.MdocSession$MdocApp5$$Lambda$14316/0x0000000103cbc840@6f85339
// f = repl.MdocSession$MdocApp5$$Lambda$14317/0x0000000103cec040@29f125b
// )</span></code></pre>
<p>which makes it clearer that we&#39;re generating three different circles.
&lt;/div&gt;</p>
Expand All @@ -384,17 +384,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$14296/0x0000000103cd4840@29bbe9a4
// f = cats.free.Free$$Lambda$14297/0x0000000103ce0840@42343461
// )
</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$14296/0x0000000103cd4840@29bbe9a4
// f = cats.free.Free$$Lambda$14297/0x0000000103ce0840@42343461
// ),
// f = cats.free.Free$$Lambda$14296/0x0000000103cd4840@4064326
// f = cats.free.Free$$Lambda$14297/0x0000000103ce0840@708269a9
// )
</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 @@ -191,29 +191,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.14871277631836521
</span><span class="comment">// res0: Double = 0.8592112704140197
</span><span class="identifier">math</span><span>.</span><span class="identifier">random</span><span>
</span><span class="comment">// res1: Double = 0.4740502298630307</span></code></pre>
</span><span class="comment">// res1: Double = 0.015076022226287122</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(3.883470742309488)
</span><span class="comment">// res2: Angle = Angle(5.545797890638325)
</span><span class="identifier">randomAngle</span><span>
</span><span class="comment">// res3: Angle = Angle(4.552529726511162)</span></code></pre>
</span><span class="comment">// res3: Angle = Angle(1.782020522315986)</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(4.213217351688848)
</span><span class="comment">// result1: Angle = Angle(4.779245324944438)
</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(5.938966261686806)</span></code></pre>
</span><span class="comment">// result2: Angle = Angle(1.5302853440979431)</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(0.8037007176404501)
</span><span class="comment">// result1: Angle = Angle(5.574930391985445)
</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(0.8037007176404501)</span></code></pre>
</span><span class="comment">// result2: Angle = Angle(5.574930391985445)</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 @@ -176,7 +176,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.4127217288889149</span></code></pre>
</span><span class="comment">// res0: Double = 0.6272076172571756</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 @@ -214,9 +214,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.883644526467409)
</span><span class="comment">// res1: Angle = Angle(1.2533948746081445)
</span><span class="identifier">randomAngle</span><span>.</span><span class="identifier">run</span><span>
</span><span class="comment">// res2: Angle = Angle(5.469383404532865)</span></code></pre>
</span><span class="comment">// res2: Angle = Angle(2.406653605604647)</span></code></pre>

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

Expand Down
16 changes: 8 additions & 8 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14122,6 +14122,10 @@ $c_Lpolygons_Creative$.prototype.spiralExercise = (function(arg) {
var prep0 = $as_T(arg);
this.spiralExercise__T__V(prep0)
});
$c_Lpolygons_Creative$.prototype.curvygonExercise = (function(arg) {
var prep0 = $as_T(arg);
this.curvygonExercise__T__V(prep0)
});
$c_Lpolygons_Creative$.prototype.bezierCurveAnimation = (function(arg) {
var prep0 = $as_T(arg);
this.bezierCurveAnimation__T__V(prep0)
Expand All @@ -14138,10 +14142,6 @@ $c_Lpolygons_Creative$.prototype.starPolygonExercise = (function(arg) {
var prep0 = $as_T(arg);
this.starPolygonExercise__T__V(prep0)
});
$c_Lpolygons_Creative$.prototype.curvygonExercise = (function(arg) {
var prep0 = $as_T(arg);
this.curvygonExercise__T__V(prep0)
});
var $d_Lpolygons_Creative$ = new $TypeData().initClass({
Lpolygons_Creative$: 0
}, false, "polygons.Creative$", {
Expand Down Expand Up @@ -14557,6 +14557,10 @@ $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.vertices = (function(arg) {
var prep0 = $as_T(arg);
this.vertices__T__V(prep0)
});
$c_Lpolygons_Polygons$.prototype.points = (function(arg) {
var prep0 = $as_T(arg);
this.points__T__V(prep0)
Expand All @@ -14565,10 +14569,6 @@ $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)
});
var $d_Lpolygons_Polygons$ = new $TypeData().initClass({
Lpolygons_Polygons$: 0
}, false, "polygons.Polygons$", {
Expand Down
2 changes: 1 addition & 1 deletion main.js.map

Large diffs are not rendered by default.

27 changes: 26 additions & 1 deletion part-one-conclusions.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,33 @@
<main class="content">
<h1 id="part-one-conclusions" class="title">Part One: Conclusions</h1>
<p>We&#39;ve reached the end of Part One, which focused on creative computing.
Before we set this topic aside, let&#39;s discuss some places where you find more on creative computing should you wish to continue exploring this domain. </p>
Before we set this topic aside, let&#39;s mention some places to find more if you want to go further on your own.
This is not intended to be in any way an authorative collection.
It&#39;s just people, books, and sites that I&#39;ve found inspiring.</p>

<h2 id="artists" class="section">Artists</h2>
<p>We&#39;ll start with a few artists.</p>
<ul>
<li><a href="https://sasj.nl/">Saskia Freeke</a> is an artist and designer based in Amsterdam. She posts a new artwork every day on her social media. A lot of her works use simple geometric shapes arranged on a grid, which are very amenable to reproducing in Doodle using the techniques we&#39;ve learned so far.</li>
<li><a href="https://georgemsavva.github.io/creativecoding/">George Savva</a> is a statistican living in the UK who creates algorithmic art as a hobby. He posts some detailed breakdowns of the process behind his images <a href="https://georgemsavva.github.io/creativecoding/posts/lissajous/">such as this post using Lissajous curves</a>.</li>
<li><a href="http://www.complexification.net/gallery/">Jared Tarbell</a></li>
<li><a href="https://isohedral.ca/">Craig Kaplan</a></li>
</ul>

<h2 id="books" class="section">Books</h2>
<ul>
<li><a href="https://press.princeton.edu/books/hardcover/9780691161730/creating-symmetry">Creating Symmetry</a></li>
</ul>
<p><a href="https://processing.org/">Processing</a> and <a href="https://p5js.org/">p5js</a></p>
<p>Coding train</p>
<p><a href="https://genuary.art/">Genuary</a></p>

<h2 id="academics" class="section">Academics</h2>
<ul>
<li><a href="http://people.cs.uchicago.edu/~rchugh/">Ravi Chugh</a></li>
<li><a href="http://www.galaxykate.com/">Kate Compton</a></li>
<li><a href="https://www.convivial.tools/">Chris Martens</a></li>
</ul>
<div class="flex flex-row justify-between">
<a class="pageNavigation" href="cycles/conclusions.html">←Conclusions</a>
</div>
Expand Down

0 comments on commit 2031596

Please sign in to comment.