Skip to content

Commit 2ca974a

Browse files
committed
Get Mathjax into tutorial
1 parent bf98b44 commit 2ca974a

11 files changed

+39
-37
lines changed

web/array_old_01.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636
.caveat { background-color:#FF8080; color:black; }
3737
</style>
3838

39+
<script type="text/javascript" async
40+
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
41+
</script>
3942
<script type="text/x-mathjax-config">
4043
MathJax.Hub.Config({
4144
tex2jax: {
4245
skipTags: ["script","noscript","style","textarea"]
4346
}
4447
});
4548
</script>
46-
<script type="text/javascript"
47-
src="http://cdn.mathjax.org/mathjax/latest/MathJax.jsconfig=TeX-AMS-MML_HTMLorMML">
48-
</script>
4949
<title>Array Abstraction</title></head><body>
5050
<style>
5151
body {margin:3%; font-family: sans-serif; }

web/array_old_04.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636
.caveat { background-color:#FF8080; color:black; }
3737
</style>
3838

39+
<script type="text/javascript" async
40+
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
41+
</script>
3942
<script type="text/x-mathjax-config">
4043
MathJax.Hub.Config({
4144
tex2jax: {
4245
skipTags: ["script","noscript","style","textarea"]
4346
}
4447
});
4548
</script>
46-
<script type="text/javascript"
47-
src="http://cdn.mathjax.org/mathjax/latest/MathJax.jsconfig=TeX-AMS-MML_HTMLorMML">
48-
</script>
4949
<title>/Users/skaller/felix/src/web/tut/array_old_04.html</title></head><body>
5050
<style>
5151
body {margin:3%; font-family: sans-serif; }

web/corout.html

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ <h1 id='A_low_level_example._h'><img src='/share/src/web/images/minus.gif' id='A
426426
down the channel <code>out</code>. The type <code>%>int</code> is an output channel endpoint
427427
for <code>int</code>.
428428
</p><pre class='inclusion'>
429-
examples/ex1.flx</pre>
429+
examples/corout/ex1.flx</pre>
430430
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="Define a procedure, a function with side-effects not returning a value">proc</span> source (out: %&gt;<span class="library" title="binding of C int type">int</span>) () {
431431
<span class="lineno" id=line2></span> <span class="big_keyword" title="Define a mutable variable">var</span> i = 0;
432432
<span class="lineno" id=line3></span> <span class="small_keyword" title="while loop">while</span> <span class="library" title="truth value">true</span> <span class="small_keyword" title="imperative code begins">do</span>
@@ -437,7 +437,7 @@ <h1 id='A_low_level_example._h'><img src='/share/src/web/images/minus.gif' id='A
437437
</pre></p></div><h2 id='The_sink_h'><img src='/share/src/web/images/minus.gif' id='The sink' onclick='toggle(this,"The_sink_d")' alt='+'/> 1.2 The sink</h2><div id='The_sink_d' style='display:block'>
438438
<p>Now we have a simple sink, which just prints everything it reads:
439439
</p><pre class='inclusion'>
440-
examples/ex1.flx</pre>
440+
examples/corout/ex1.flx</pre>
441441
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="Define a procedure, a function with side-effects not returning a value">proc</span> sink (inp: %&lt;<span class="library" title="binding of C int type">int</span>) () {
442442
<span class="lineno" id=line2></span> <span class="small_keyword" title="while loop">while</span> <span class="library" title="truth value">true</span> <span class="small_keyword" title="imperative code begins">do</span>
443443
<span class="lineno" id=line3></span> <span class="big_keyword" title="Define a mutable variable">var</span> i = read inp;
@@ -451,7 +451,7 @@ <h1 id='A_low_level_example._h'><img src='/share/src/web/images/minus.gif' id='A
451451
</p></div><h2 id='The_transducer_h'><img src='/share/src/web/images/minus.gif' id='The transducer' onclick='toggle(this,"The_transducer_d")' alt='+'/> 1.3 The transducer</h2><div id='The_transducer_d' style='display:block'>
452452
<p>Now we have a transducer which writes the square of every integer it reads.
453453
</p><pre class='inclusion'>
454-
examples/ex1.flx</pre>
454+
examples/corout/ex1.flx</pre>
455455
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="Define a procedure, a function with side-effects not returning a value">proc</span> squarer (inp: %&lt;<span class="library" title="binding of C int type">int</span>, out: %&gt;<span class="library" title="binding of C int type">int</span>) () {
456456
<span class="lineno" id=line2></span> <span class="small_keyword" title="while loop">while</span> <span class="library" title="truth value">true</span> <span class="small_keyword" title="imperative code begins">do</span>
457457
<span class="lineno" id=line3></span> <span class="big_keyword" title="Define a mutable variable">var</span> i = read inp;
@@ -462,7 +462,7 @@ <h1 id='A_low_level_example._h'><img src='/share/src/web/images/minus.gif' id='A
462462
<p>You should notice the previous three components were all infinite loops.
463463
Since we don't want our demo to run forever we will throw in a limiter chip:
464464
</p><pre class='inclusion'>
465-
examples/ex1.flx</pre>
465+
examples/corout/ex1.flx</pre>
466466
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="Define a procedure, a function with side-effects not returning a value">proc</span> limiter (<span class="big_keyword" title="Define a mutable variable">var</span> limit: <span class="library" title="binding of C int type">int</span>) (inp: %&lt;<span class="library" title="binding of C int type">int</span>, out: %&gt;<span class="library" title="binding of C int type">int</span>) () {
467467
<span class="lineno" id=line2></span> <span class="small_keyword" title="while loop">while</span> limit &gt; 0 <span class="small_keyword" title="imperative code begins">do</span>
468468
<span class="lineno" id=line3></span> <span class="big_keyword" title="Define a mutable variable">var</span> i = read inp;
@@ -476,7 +476,7 @@ <h1 id='A_low_level_example._h'><img src='/share/src/web/images/minus.gif' id='A
476476
</p></div><h2 id='The_runner_h'><img src='/share/src/web/images/minus.gif' id='The runner' onclick='toggle(this,"The_runner_d")' alt='+'/> 1.5 The runner</h2><div id='The_runner_d' style='display:block'>
477477
<p>Now we need have four components so we need three channels to connect them:
478478
</p><pre class='inclusion'>
479-
examples/ex1.flx</pre>
479+
examples/corout/ex1.flx</pre>
480480
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="Define a procedure, a function with side-effects not returning a value">proc</span> run_pipeline() {
481481
<span class="lineno" id=line2></span> <span class="comment">// make channels</span>
482482
<span class="lineno" id=line3></span> <span class="big_keyword" title="Define a mutable variable">var</span> i1,o1 = mk_ioschannel_pair[<span class="library" title="binding of C int type">int</span>]();
@@ -507,7 +507,7 @@ <h1 id='A_low_level_example._h'><img src='/share/src/web/images/minus.gif' id='A
507507
specific <em>sub-</em>languages.
508508
</p><p>Let me show you: first our source:
509509
</p><pre class='inclusion'>
510-
examples/ex2.flx</pre>
510+
examples/corout/ex2.flx</pre>
511511
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="defines a coroutine using chip idiom">chip</span> source
512512
<span class="lineno" id=line2></span> <span class="small_keyword" title="the parameter of a chip">connector</span> io
513513
<span class="lineno" id=line3></span> <span class="small_keyword" title="a field of the chip parameter">pin</span> out: %&gt;<span class="library" title="binding of C int type">int</span>
@@ -524,7 +524,7 @@ <h1 id='A_low_level_example._h'><img src='/share/src/web/images/minus.gif' id='A
524524
actually has a record type.
525525
</p><p>Now here is the sink:
526526
</p><pre class='inclusion'>
527-
examples/ex2.flx</pre>
527+
examples/corout/ex2.flx</pre>
528528
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="defines a coroutine using chip idiom">chip</span> sink
529529
<span class="lineno" id=line2></span> <span class="small_keyword" title="the parameter of a chip">connector</span> io
530530
<span class="lineno" id=line3></span> <span class="small_keyword" title="a field of the chip parameter">pin</span> inp: %&lt;<span class="library" title="binding of C int type">int</span>
@@ -536,7 +536,7 @@ <h1 id='A_low_level_example._h'><img src='/share/src/web/images/minus.gif' id='A
536536
<span class="lineno" id=line9></span> }
537537
</pre></p><p>Now here is the transducer and limiter
538538
</p><pre class='inclusion'>
539-
examples/ex2.flx</pre>
539+
examples/corout/ex2.flx</pre>
540540
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="defines a coroutine using chip idiom">chip</span> squarer
541541
<span class="lineno" id=line2></span> <span class="small_keyword" title="the parameter of a chip">connector</span> io
542542
<span class="lineno" id=line3></span> <span class="small_keyword" title="a field of the chip parameter">pin</span> inp: %&lt;<span class="library" title="binding of C int type">int</span>
@@ -560,7 +560,7 @@ <h1 id='A_low_level_example._h'><img src='/share/src/web/images/minus.gif' id='A
560560
<span class="lineno" id=line21></span> };
561561
</pre></p><p>Now to connect these things we say this:
562562
</p><pre class='inclusion'>
563-
examples/ex2.flx</pre>
563+
examples/corout/ex2.flx</pre>
564564
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="Define a procedure, a function with side-effects not returning a value">proc</span> run_pipeline1() {
565565
<span class="lineno" id=line2></span> <span class="small_keyword" title="a synonym for var to suit the chip idiom">device</span> limit8 = limiter 8;
566566
<span class="lineno" id=line3></span> <span class="small_keyword" title="defines the topology of chip connections">circuit</span>
@@ -579,7 +579,7 @@ <h1 id='A_low_level_example._h'><img src='/share/src/web/images/minus.gif' id='A
579579
</p><p>The <code>circuit</code> feature is very general. For pipelines there is an even easer
580580
syntax:
581581
</p><pre class='inclusion'>
582-
examples/ex2.flx</pre>
582+
examples/corout/ex2.flx</pre>
583583
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="Define a procedure, a function with side-effects not returning a value">proc</span> run_pipeline2() {
584584
<span class="lineno" id=line2></span> (source |-&gt; squarer |-&gt; limiter 8 |-&gt; sink)();
585585
<span class="lineno" id=line3></span> }
@@ -618,7 +618,7 @@ <h1 id='A_low_level_example._h'><img src='/share/src/web/images/minus.gif' id='A
618618
</p><p>However we will demonstrate a simpler service, namely the system alarm closk
619619
because it has a really simply API.
620620
</p><pre class='inclusion'>
621-
examples/ex3.flx</pre>
621+
examples/corout/ex3.flx</pre>
622622
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="library" title="Print a string to standard output with newline appended">println</span>$ <span class="fstring">"Begin Spawning"</span>;
623623
<span class="lineno" id=line2></span>
624624
<span class="lineno" id=line3></span> <span class="big_keyword" title="Spawn a cooperative fibre">spawn_fthread</span> {
@@ -739,7 +739,7 @@ <h3 id='write_h'><img src='/share/src/web/images/minus.gif' id='write' onclick='
739739
</p></div></div><h1 id='No_Deadlocks_h'><img src='/share/src/web/images/minus.gif' id='No Deadlocks' onclick='toggle(this,"No_Deadlocks_d")' alt='+'/> 5 No Deadlocks</h1><div id='No_Deadlocks_d' style='display:block'>
740740
<p>Most threading systems can deadlock. Here is the classical situation:
741741
</p><pre class='inclusion'>
742-
examples/ex5.flx</pre>
742+
examples/corout/ex5.flx</pre>
743743
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="defines a coroutine using chip idiom">chip</span> D <span class="small_keyword" title="the parameter of a chip">connector</span> io <span class="small_keyword" title="a field of the chip parameter">pin</span> inp: %&lt;<span class="library" title="binding of C int type">int</span> <span class="small_keyword" title="a field of the chip parameter">pin</span> out: %&gt;<span class="library" title="binding of C int type">int</span>
744744
<span class="lineno" id=line2></span> {
745745
<span class="lineno" id=line3></span> <span class="small_keyword" title="while loop">while</span> <span class="library" title="truth value">true</span> <span class="small_keyword" title="imperative code begins">do</span>
@@ -762,7 +762,9 @@ <h3 id='write_h'><img src='/share/src/web/images/minus.gif' id='write' onclick='
762762
</p><p><bf style="color:red">FELIX COROUTINES CANNOT DEADLOCK</bf>
763763
</p><p>However they can <em>livelock</em>, but only if you mismanage
764764
manual circuit construction. Here's an example:
765-
</p><p><pre class="prefmtbg">var inp,out = mk_ioschannel_pair[int]();
765+
</p><pre class='inclusion'>
766+
examples/corout/ex6.fx</pre>
767+
<p><pre class="prefmtbg">var inp,out = mk_ioschannel_pair[int]();
766768
spawn_fthread { write (out, 42); };
767769
</pre></p><p>This is a livelock because the mainline <em>could</em> read
768770
the written data on the channel endpoint <code>inp</code> but doesn't.

web/embedc.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ <h1 id='Basics_h'><img src='/share/src/web/images/minus.gif' id='Basics' onclick
443443
</pre></p><p>If you run it at this point without the rest of the tutorial, this happens:
444444
</p><p><pre class="prefmtbg">CLIENT ERROR
445445
[flx_frontend/flx_typeclass.ml:752: E367] [Cannotmatch] Cannot instantiate virtual str&lt;17781&gt;[Nominal[] cplx]
446-
In /Users/skaller/felix/src/packages/core_type_constructors.fdoc: line 693, cols 4 to 59
446+
In /Users/skaller/felix/src/packages/core_type_constructors.html: line 693, cols 4 to 59
447447
692: instance[T] Str[T*T] {
448448
693: fun str (t1:T, t2:T) =&gt; "("+str t1 + ", " + str t2+")";
449449
********************************************************

web/func_01.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,8 +543,8 @@ <h2 id='Felix_functions_h'><img src='/share/src/web/images/minus.gif' id='Felix
543543
<span class="lineno" id=line2></span> <span class="big_keyword" title="Define a function with no side-effects">fun</span> g(y:<span class="library" title="binding of C long type">long</span>)=&gt; x.<span class="library" title="binding of C long type">long</span> + y;
544544
<span class="lineno" id=line3></span> <span class="small_keyword" title="return">return</span> g;
545545
<span class="lineno" id=line4></span> }
546-
</pre></p><p>The function <code>f</code> here has type {int -> (long -> long)}. This type is
547-
the same as {int -> long -> long} since the arrow operator is right
546+
</pre></p><p>The function <code>f</code> here has type <code>int -> (long -> long)</code>. This type is
547+
the same as <code>int -> long -> long</code> since the arrow operator is right
548548
associative. There's a simpler way to write the function <code>f</code>:
549549
</p><p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="Define a function with no side-effects">fun</span> f(x:<span class="library" title="binding of C int type">int</span>) (y:<span class="library" title="binding of C long type">long</span>) =&gt; x.<span class="library" title="binding of C long type">long</span> + y;
550550
</pre></p><p>Here one says <code>f</code> has arity 2. Note it still has only

web/intro_11.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636
.caveat { background-color:#FF8080; color:black; }
3737
</style>
3838

39+
<script type="text/javascript" async
40+
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
41+
</script>
3942
<script type="text/x-mathjax-config">
4043
MathJax.Hub.Config({
4144
tex2jax: {
4245
skipTags: ["script","noscript","style","textarea"]
4346
}
4447
});
4548
</script>
46-
<script type="text/javascript"
47-
src="http://cdn.mathjax.org/mathjax/latest/MathJax.jsconfig=TeX-AMS-MML_HTMLorMML">
48-
</script>
4949
<title>/Users/skaller/felix/src/web/tut/intro_11.html</title></head><body>
5050
<style>
5151
body {margin:3%; font-family: sans-serif; }

web/pattern_01.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636
.caveat { background-color:#FF8080; color:black; }
3737
</style>
3838

39+
<script type="text/javascript" async
40+
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
41+
</script>
3942
<script type="text/x-mathjax-config">
4043
MathJax.Hub.Config({
4144
tex2jax: {
4245
skipTags: ["script","noscript","style","textarea"]
4346
}
4447
});
4548
</script>
46-
<script type="text/javascript"
47-
src="http://cdn.mathjax.org/mathjax/latest/MathJax.jsconfig=TeX-AMS-MML_HTMLorMML">
48-
</script>
4949
<title>/Users/skaller/felix/src/web/tut/pattern_01.html</title></head><body>
5050
<style>
5151
body {margin:3%; font-family: sans-serif; }

web/polymorphism_01.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ <h1 id='Polymorphism_h'><img src='/share/src/web/images/minus.gif' id='Polymorph
406406
</pre></p><p>C bindings can be polymorphic too:
407407
</p><p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="big_keyword" title="Define a primitive type by binding to a C type">type</span> vector[T] = <span class="fstring">"::std::vector&lt;?1&gt;"</span>;
408408
<span class="lineno" id=line2></span> <span class="big_keyword" title="Define a procedure, a function with side-effects not returning a value">proc</span> push_back[T]: vector[T] * T = <span class="fstring">"$1.push_back($2)"</span>;
409-
</pre></p><p>In the C code {?1}, {?2} represent the
409+
</pre></p><p>In the C code <code>?1</code>, <code>?2</code> represent the
410410
first and second type variables.
411411
</p><h2 id='Overloading_h'><img src='/share/src/web/images/minus.gif' id='Overloading' onclick='toggle(this,"Overloading_d")' alt='+'/> 1.1.1 Overloading</h2><div id='Overloading_d' style='display:block'>
412412
<p>Polymorphic functions and non-polymorphic function can be overloaded.

web/polymorphism_02.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636
.caveat { background-color:#FF8080; color:black; }
3737
</style>
3838

39+
<script type="text/javascript" async
40+
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML">
41+
</script>
3942
<script type="text/x-mathjax-config">
4043
MathJax.Hub.Config({
4144
tex2jax: {
4245
skipTags: ["script","noscript","style","textarea"]
4346
}
4447
});
4548
</script>
46-
<script type="text/javascript"
47-
src="http://cdn.mathjax.org/mathjax/latest/MathJax.jsconfig=TeX-AMS-MML_HTMLorMML">
48-
</script>
4949
<title>/Users/skaller/felix/src/web/tut/polymorphism_02.html</title></head><body>
5050
<style>
5151
body {margin:3%; font-family: sans-serif; }
@@ -444,7 +444,7 @@ <h1 id='Type_Constraints_h'><img src='/share/src/web/images/minus.gif' id='Type
444444
<span class="lineno" id=line2></span> <span class="big_keyword" title="Define a function with no side-effects">fun</span> f: !integers * !integers -&gt; <span class="library" title="binding of C int type">int</span> = <span class="fstring">"f($1, $2)"</span> <span class="big_keyword" title="specify requirements">requires</span> myf;
445445
</pre></p><p>The reason this is <em>so</em> useful is that if we just lifted the
446446
signature of <code>f</code> from C, we'd be ignoring the fact that the C programmer
447-
has automatic conversions and can call {f(42L, 23u)}, which would
447+
has automatic conversions and can call <code>f(42L, 23u)</code>, which would
448448
fail in Felix because it has no automatic conversions. The user
449449
would have to cast every argument to exactly the right type which is
450450
not practical. By using constrained polymorphism, we can make

web/string_01.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@
420420
<h1 id='Reference._h'><img src='/share/src/web/images/minus.gif' id='Reference.' onclick='toggle(this,"Reference._d")' alt='+'/> 1.1 Reference.</h1><div id='Reference._d' style='display:block'>
421421
<p>See <a href="/share/lib/std/strings/string.html">string</a> module.
422422
</p></div><h1 id='Concept._h'><img src='/share/src/web/images/minus.gif' id='Concept.' onclick='toggle(this,"Concept._d")' alt='+'/> 1.2 Concept.</h1><div id='Concept._d' style='display:block'>
423-
<p>Felix uses a binding to the C++ string datatype {::std::basic_string&lt;char&gt;}.
423+
<p>Felix uses a binding to the C++ string datatype <code>::std::basic_string&lt;char&gt;</code>.
424424
</p></div><h1 id='String_subscript_and_slices._h'><img src='/share/src/web/images/minus.gif' id='String subscript and slices.' onclick='toggle(this,"String_subscript_and_slices._d")' alt='+'/> 1.3 String subscript and slices.</h1><div id='String_subscript_and_slices._d' style='display:block'>
425425
<p><pre class='flxbg'><span class="lineno" id=line1></span> <span class="comment">//Check String::subscript</span>
426426
<span class="lineno" id=line2></span> <span class="library" title="Print a string to standard output">print</span>$ <span class="fstring">"hello how are you"</span>.[4]; endl;

0 commit comments

Comments
 (0)