Added course's notes
This commit is contained in:
1 parent
e07993262c
commit
dcd2c072ae
191 files changed
+42866
-12
No files matched your search
@@ -0,0 +1,156 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 230" width="760" height="230"
|
||||
role="img" aria-labelledby="dc-title">
|
||||
<title id="dc-title">The procedural version: inside one main(), IO.readln() is called, its result is passed to rot13(), and that result is passed to IO.println(). One thread, one process, three direct calls.</title>
|
||||
<style><![CDATA[
|
||||
/* figures/diagram.css -- shared look of every built figure.
|
||||
*
|
||||
* build-figures.py drops this file into the style element of every built
|
||||
* svg, so a figure carries its own styling and stays self-contained.
|
||||
* Classes, not per-element fills, do the work: one edit here restyles the
|
||||
* whole book.
|
||||
*
|
||||
* The palette is theme.scss's: teal #20666f for structure, amber #8a5a08 for
|
||||
* the warning accent, ink #1b2430 for text, IBM Plex to match the page.
|
||||
*
|
||||
* Dark theme: the @media block follows the reader's system setting. librsvg
|
||||
* ignores media queries when it makes the pdf, so print always gets the light
|
||||
* theme -- which is what a printed page wants.
|
||||
*/
|
||||
|
||||
svg {
|
||||
font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
|
||||
/* the figure sits on the page, not on a white card of its own */
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* ---- surfaces ------------------------------------------------------- */
|
||||
|
||||
.box { fill: #eef3f7; stroke: #20666f; stroke-width: 1.4; }
|
||||
.box-weak { fill: #eef3f7; stroke: #20666f; stroke-width: 1.4; }
|
||||
.box-accent { fill: #e5eff1; stroke: #20666f; stroke-width: 1.8; }
|
||||
.box-warn { fill: #f8f1e0; stroke: #8a5a08; stroke-width: 1.4; }
|
||||
.box-plain { fill: #fbfcfd; stroke: #dae0e8; stroke-width: 1.2; }
|
||||
.diamond { fill: #e5eff1; stroke: #20666f; stroke-width: 1.4; }
|
||||
.ellipse { fill: #fbfcfd; stroke: #5a6879; stroke-width: 1.2; }
|
||||
|
||||
/* ---- lines ---------------------------------------------------------- */
|
||||
|
||||
.edge { fill: none; stroke: #5a6879; stroke-width: 1.3; }
|
||||
.edge-strong{ fill: none; stroke: #20666f; stroke-width: 1.8; }
|
||||
.edge-warn { fill: none; stroke: #8a5a08; stroke-width: 1.6; }
|
||||
.edge-dash { fill: none; stroke: #5a6879; stroke-width: 1.2; stroke-dasharray: 5 3; }
|
||||
.rule { stroke: #dae0e8; stroke-width: 1; }
|
||||
|
||||
/* ---- text ----------------------------------------------------------- */
|
||||
|
||||
.t { fill: #1b2430; font-size: 13px; }
|
||||
.t-sm { fill: #1b2430; font-size: 11px; }
|
||||
.t-lead { fill: #1b2430; font-size: 14px; font-weight: 600; }
|
||||
.t-mut { fill: #5a6879; font-size: 11px; }
|
||||
.t-key { fill: #1b2430; font-size: 12px; text-decoration: underline; }
|
||||
.t-accent { fill: #20666f; font-size: 12px; font-weight: 600; }
|
||||
.t-warn { fill: #8a5a08; font-size: 12px; font-weight: 600; }
|
||||
.t-mono { fill: #1b2430; font-size: 11.5px;
|
||||
font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; }
|
||||
|
||||
.mid { text-anchor: middle; }
|
||||
.end { text-anchor: end; }
|
||||
|
||||
/* ---- interaction ====================================================
|
||||
* A .node groups one box with its labels. Hovering it lifts the whole group
|
||||
* a little, which is enough to follow a path through a busy diagram without
|
||||
* any script. Pointer events stay off the decorative layers so the hover
|
||||
* target is the shape itself.
|
||||
*/
|
||||
|
||||
.node { transition: opacity .12s ease; }
|
||||
.node:hover .box,
|
||||
.node:hover .box-accent,
|
||||
.node:hover .diamond { stroke-width: 2.6; }
|
||||
.node:hover .t, .node:hover .t-lead { fill: #20666f; }
|
||||
|
||||
svg:hover .node:not(:hover) { opacity: .55; }
|
||||
|
||||
/* a figure that marks no nodes must not dim on hover */
|
||||
svg:not(:has(.node)) .node { opacity: 1; }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.node { transition: none; }
|
||||
}
|
||||
|
||||
/* ---- dark theme ------------------------------------------------------ */
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.box { fill: #1d2b33; stroke: #4c9aa5; }
|
||||
.box-weak { fill: #1d2b33; stroke: #4c9aa5; }
|
||||
.box-accent { fill: #24363d; stroke: #4c9aa5; }
|
||||
.box-warn { fill: #332a18; stroke: #c99a3a; }
|
||||
.box-plain { fill: #161b22; stroke: #30363d; }
|
||||
.diamond { fill: #24363d; stroke: #4c9aa5; }
|
||||
.ellipse { fill: #161b22; stroke: #8b98a8; }
|
||||
|
||||
.edge { stroke: #8b98a8; }
|
||||
.edge-strong{ stroke: #4c9aa5; }
|
||||
.edge-warn { stroke: #c99a3a; }
|
||||
.edge-dash { stroke: #8b98a8; }
|
||||
.rule { stroke: #30363d; }
|
||||
|
||||
.t, .t-sm, .t-lead, .t-key, .t-mono { fill: #e6edf3; }
|
||||
.t-mut { fill: #8b98a8; }
|
||||
.t-accent { fill: #4c9aa5; }
|
||||
.t-warn { fill: #c99a3a; }
|
||||
|
||||
.node:hover .t, .node:hover .t-lead { fill: #7fc4cf; }
|
||||
|
||||
.arrow { fill: #8b98a8; }
|
||||
.arrow-strong { fill: #4c9aa5; }
|
||||
.arrow-warn { fill: #c99a3a; }
|
||||
}
|
||||
|
||||
/* ---- arrowheads ======================================================
|
||||
* marker contents cannot inherit the referencing element's fill, so each
|
||||
* arrowhead is its own class and is themed alongside the line it ends.
|
||||
*/
|
||||
|
||||
.arrow { fill: #5a6879; }
|
||||
.arrow-strong { fill: #20666f; }
|
||||
.arrow-warn { fill: #8a5a08; }
|
||||
|
||||
]]></style>
|
||||
|
||||
<defs>
|
||||
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5"
|
||||
markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse">
|
||||
<path class="arrow" d="M0,0 L10,5 L0,10 z"/>
|
||||
</marker>
|
||||
</defs>
|
||||
|
||||
<!-- everything happens inside one main(), on one thread -->
|
||||
<rect class="box-plain" x="14" y="16" width="732" height="126" rx="4"/>
|
||||
<text class="t-mut" data-label="frame" x="26" y="36">one process · one thread · one main()</text>
|
||||
|
||||
<g class="node" data-flow-node="read">
|
||||
<rect class="box" x="40" y="58" width="170" height="52" rx="3"/>
|
||||
<text class="t-mono mid" data-label="read" x="125" y="90">IO.readln()</text>
|
||||
</g>
|
||||
|
||||
<path class="edge" data-flow="1" data-flow-to="rot" d="M210,84 H298" marker-end="url(#a)"/>
|
||||
<text class="t-accent mid" data-label="call1" x="254" y="72">call</text>
|
||||
|
||||
<g class="node" data-flow-node="rot">
|
||||
<rect class="box" x="300" y="58" width="170" height="52" rx="3"/>
|
||||
<text class="t-mono mid" data-label="rot" x="385" y="90">rot13(text)</text>
|
||||
</g>
|
||||
|
||||
<path class="edge" data-flow="2" data-flow-to="print" d="M470,84 H558" marker-end="url(#a)"/>
|
||||
<text class="t-accent mid" data-label="call2" x="514" y="72">call</text>
|
||||
|
||||
<g class="node" data-flow-node="print">
|
||||
<rect class="box" x="560" y="58" width="170" height="52" rx="3"/>
|
||||
<text class="t-mono mid" data-label="print" x="645" y="90">IO.println(…)</text>
|
||||
</g>
|
||||
|
||||
<!-- who knows whom -->
|
||||
<text class="t-sm" data-label="knows" x="14" y="176">main() knows all three: their names, argument and result types, and that they are available right now.</text>
|
||||
<text class="t-mut" data-label="cost" x="14" y="202">The wiring is written into the code itself — step 1 of the tutorial.</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.5 KiB |
Reference in new issue
Block a user