Skip to content

Commit

Permalink
add the advanced section
Browse files Browse the repository at this point in the history
  • Loading branch information
kybernetikos committed Dec 15, 2010
1 parent 895e7ed commit 72dc551
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions index.html
Expand Up @@ -80,6 +80,7 @@ <h2>Contents</h2>
<li><a href="#functions-js">Interacting with Javascript and the Browser</a></li>
</ol>
</li>
<li><a href="#advanced">More Examples</a></li>
<li><a href="#have-a-go">Have a Go</a></li>
<li><a href="#getting-source">Getting the Source</a></li>
<li><a href="#limitations">Limitations</a></li>
Expand Down Expand Up @@ -247,6 +248,18 @@ <h2>Contents</h2>
]);
</script>

<a name="advanced"><h2>More Examples</h2></a>

<p>The <a href="">Y combinator</a> is "one of the most strange and wonderful artifacts of Computer Science" according to Douglas Crockford.
It allows you to write an anoymous function that can use recursion (not that this is something that comes up a lot...). There's a good explanation of it <a href="http://rayfd.wordpress.com/2007/05/06/y-combinator-for-dysfunctional-non-schemers/">here</a>.</p>

<script type="text/javascript">
insertExamples([
"(def Y\n (lambda (f)\n (let ((future\n (lambda (future)\n (f (lambda (arg) \n ((future future) arg))))))\n (future future))))",
"((Y (lambda (fac)\n (lambda (n)\n (if (= n 0)\n 1\n (* n (fac (- n 1)))))))\n5)"
]);
</script>

<a name="have-a-go"><h2>Have a go</h2></a>

<textarea id='code_entry'>(let
Expand Down

0 comments on commit 72dc551

Please sign in to comment.