Permalink
Browse files

slide on direct style

  • Loading branch information...
Jake Donham
Jake Donham committed Sep 24, 2010
1 parent debba3b commit b1b8b2353b4e838603334364907fe0a19c7c3e0c
Showing with 31 additions and 0 deletions.
  1. +31 −0 examples/froc-dom/talk/index.html
@@ -446,6 +446,37 @@ <h2>Why OCaml for FRP?</h2>
</ul>
</div>
+ <div id="direct" class="slide" style="display:none">
+ <h2>Direct style FRP</h2>
+
+ <p>With a syntax extension:</p>
+
+<pre>
+ <span class="tuareg-font-lock-governing">let</span> <span class="variable-name">b3 </span><span class="tuareg-font-lock-operator">=</span> <span class="tuareg-font-lock-governing">lbt</span> <span class="variable-name">b1 </span><span class="tuareg-font-lock-operator">=</span> b1 <span class="tuareg-font-lock-governing">and</span> <span class="variable-name">b2 </span><span class="tuareg-font-lock-operator">=</span> b2 <span class="tuareg-font-lock-governing">in</span> <span class="type">Froc</span>.return <span class="tuareg-font-lock-operator">(</span>b1 <span class="tuareg-font-lock-operator">+</span> b2<span class="tuareg-font-lock-operator">)</span>
+</pre>
+
+ <p>becomes</p>
+
+<pre>
+ <span class="tuareg-font-lock-governing">let</span> <span class="variable-name">b3 </span><span class="tuareg-font-lock-operator">=</span> <span class="type">Froc</span>.bind2 b1 b2 <span class="tuareg-font-lock-operator">(</span><span class="keyword">fun</span> <span class="variable-name">b1 b2 </span><span class="tuareg-font-lock-operator">-&gt;</span> <span class="type">Froc</span>.return <span class="tuareg-font-lock-operator">(</span>b1 <span class="tuareg-font-lock-operator">+</span> b2<span class="tuareg-font-lock-operator">))</span>
+</pre>
+
+ <p>With delimited continuations:</p>
+
+ <pre>
+ <span class="tuareg-font-lock-governing">val</span><span class="variable-name"> </span><span class="tuareg-font-lock-operator">(~|)</span> <span class="tuareg-font-lock-operator">:</span> <span class="tuareg-font-lock-operator">(</span><span class="type">unit </span><span class="tuareg-font-lock-operator">-&gt;</span><span class="type"> </span><span class="tuareg-font-lock-operator">'</span><span class="type">a</span><span class="tuareg-font-lock-operator">)</span><span class="type"> </span><span class="tuareg-font-lock-operator">-&gt;</span><span class="type"> </span><span class="tuareg-font-lock-operator">'</span><span class="type">a Froc.behavior</span>
+ <span class="tuareg-font-lock-governing">val</span><span class="variable-name"> </span><span class="tuareg-font-lock-operator">(~.)</span><span class="variable-name"> </span><span class="tuareg-font-lock-operator">:</span> <span class="tuareg-font-lock-operator">'</span><span class="type">a Froc.behavior </span><span class="tuareg-font-lock-operator">-&gt;</span><span class="type"> </span><span class="tuareg-font-lock-operator">'</span><span class="type">a</span>
+
+ <span class="tuareg-font-lock-governing">let</span> <span class="variable-name">b3 </span><span class="tuareg-font-lock-operator">=</span> <span class="tuareg-font-lock-operator">~|(</span><span class="keyword">fun</span> <span class="tuareg-font-lock-operator">()</span><span class="variable-name"> </span><span class="tuareg-font-lock-operator">-&gt;</span> <span class="tuareg-font-lock-operator">~.</span>b1 <span class="tuareg-font-lock-operator">+</span> <span class="tuareg-font-lock-operator">~.</span>b2<span class="tuareg-font-lock-operator">)</span>
+</pre>
+
+ <p>is (roughly) equivalent to:</p>
+
+<pre>
+ <span class="tuareg-font-lock-governing">let</span> <span class="variable-name">b3 </span><span class="tuareg-font-lock-operator">=</span> <span class="type">Froc</span>.bind b1 <span class="tuareg-font-lock-operator">(</span><span class="keyword">fun</span> <span class="variable-name">b1 </span><span class="tuareg-font-lock-operator">-&gt;</span> <span class="type">Froc</span>.bind <span class="tuareg-font-lock-operator">(</span><span class="keyword">fun</span> <span class="variable-name">b2 </span><span class="tuareg-font-lock-operator">-&gt;</span> b1 <span class="tuareg-font-lock-operator">+</span> b2<span class="tuareg-font-lock-operator">))</span>
+</pre>
+ </div>
+
<div id="thanks" class="slide" style="display:none">
<h2>Thanks!</h2>
<p>Takeaways:</p>

0 comments on commit b1b8b23

Please sign in to comment.