Permalink
Browse files

Created gh-pages branch via GitHub

  • Loading branch information...
0 parents commit 46c811cf0472ec5fb37d661c521288cc3996a93d @rahulkmr rahulkmr committed Apr 2, 2012
Showing with 3,442 additions and 0 deletions.
  1. BIN fonts/OpenSans-Bold-webfont.eot
  2. +146 −0 fonts/OpenSans-Bold-webfont.svg
  3. BIN fonts/OpenSans-Bold-webfont.ttf
  4. BIN fonts/OpenSans-Bold-webfont.woff
  5. BIN fonts/OpenSans-BoldItalic-webfont.eot
  6. +146 −0 fonts/OpenSans-BoldItalic-webfont.svg
  7. BIN fonts/OpenSans-BoldItalic-webfont.ttf
  8. BIN fonts/OpenSans-BoldItalic-webfont.woff
  9. BIN fonts/OpenSans-Italic-webfont.eot
  10. +146 −0 fonts/OpenSans-Italic-webfont.svg
  11. BIN fonts/OpenSans-Italic-webfont.ttf
  12. BIN fonts/OpenSans-Italic-webfont.woff
  13. BIN fonts/OpenSans-Light-webfont.eot
  14. +146 −0 fonts/OpenSans-Light-webfont.svg
  15. BIN fonts/OpenSans-Light-webfont.ttf
  16. BIN fonts/OpenSans-Light-webfont.woff
  17. BIN fonts/OpenSans-LightItalic-webfont.eot
  18. +146 −0 fonts/OpenSans-LightItalic-webfont.svg
  19. BIN fonts/OpenSans-LightItalic-webfont.ttf
  20. BIN fonts/OpenSans-LightItalic-webfont.woff
  21. BIN fonts/OpenSans-Regular-webfont.eot
  22. +146 −0 fonts/OpenSans-Regular-webfont.svg
  23. BIN fonts/OpenSans-Regular-webfont.ttf
  24. BIN fonts/OpenSans-Regular-webfont.woff
  25. BIN fonts/OpenSans-Semibold-webfont.eot
  26. +146 −0 fonts/OpenSans-Semibold-webfont.svg
  27. BIN fonts/OpenSans-Semibold-webfont.ttf
  28. BIN fonts/OpenSans-Semibold-webfont.woff
  29. BIN fonts/OpenSans-SemiboldItalic-webfont.eot
  30. +146 −0 fonts/OpenSans-SemiboldItalic-webfont.svg
  31. BIN fonts/OpenSans-SemiboldItalic-webfont.ttf
  32. BIN fonts/OpenSans-SemiboldItalic-webfont.woff
  33. BIN images/bullet.png
  34. BIN images/hr.gif
  35. BIN images/nav-bg.gif
  36. +114 −0 index.html
  37. +779 −0 javascripts/respond.js
  38. +1 −0 params.json
  39. +3 −0 stylesheets/ie.css
  40. +459 −0 stylesheets/normalize.css
  41. +70 −0 stylesheets/pygment_trac.css
  42. +848 −0 stylesheets/styles.css
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,114 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <title>Functional by thoughtnirvana</title>
+ <link rel="stylesheet" href="stylesheets/styles.css">
+ <link rel="stylesheet" href="stylesheets/pygment_trac.css">
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+ <script src="javascripts/respond.js"></script>
+ <!--[if lt IE 9]>
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+ <!--[if lt IE 8]>
+ <link rel="stylesheet" href="stylesheets/ie.css">
+ <![endif]-->
+ <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
+
+ </head>
+ <body>
+
+ <div id="header">
+ <nav>
+ <li class="fork"><a href="https://github.com/thoughtnirvana/functional">Fork On GitHub</a></li>
+ <li class="downloads"><a href="https://github.com/thoughtnirvana/functional/zipball/master">ZIP</a></li>
+ <li class="downloads"><a href="https://github.com/thoughtnirvana/functional/tarball/master">TAR</a></li>
+ <li class="title">DOWNLOADS</li>
+ </nav>
+ </div><!-- end header -->
+
+ <div class="wrapper">
+
+ <section>
+ <div id="title">
+ <h1>Functional</h1>
+ <p>Functional enhancements for ruby.</p>
+ <hr>
+ <span class="credits left">Project maintained by <a href="https://github.com/thoughtnirvana">thoughtnirvana</a></span>
+ <span class="credits right">Hosted on GitHub Pages &mdash; Theme by <a href="https://github.com/mattgraham">mattgraham</a></span>
+ </div>
+
+ <h3>Functional enhancements for ruby.</h3>
+
+<p>Some utils taken from the book "The Ruby Programming Language 6.8 Functional Programming"</p>
+
+<h4>Function composition.</h4>
+
+<pre><code>&gt;&gt; sqr = lambda {|x| x * x }
+&gt;&gt; inc = lambda {|x| x + 1 }
+&gt;&gt; (sqr * inc)[5]
+=&gt; 36
+</code></pre>
+
+<h4>Function piping.</h4>
+
+<pre><code>&gt;&gt; sqr = lambda {|x| x * x }
+&gt;&gt; inc = lambda {|x| x + 1 }
+&gt;&gt; (sqr | inc)[5]
+=&gt; 26
+</code></pre>
+
+<h4>Partial function - first arguments.</h4>
+
+<pre><code>&gt;&gt; pow = lambda {|x, y| x ** y }
+&gt;&gt; (pow &gt;&gt; 10)[2]
+=&gt; 100
+</code></pre>
+
+<h4>Partial function - last arguments.</h4>
+
+<pre><code>&gt;&gt; pow = lambda {|x, y| x ** y }
+&gt;&gt; (pow &lt;&lt; 10)[2]
+=&gt; 1024
+</code></pre>
+
+<h4>Memoize.</h4>
+
+<pre><code>&gt;&gt; fact = +lambda {|n| return 1 if n &lt;= 1; n * fact[n-1]}
+&gt;&gt; fact[10]
+=&gt; 3628800
+
+&gt;&gt; fib = +lambda {|n| return n if n &lt;= 1; fib[n-1] + fib[n-2] }
+&gt;&gt; fib[100]
+=&gt; 354224848179261915075
+</code></pre>
+
+<h3>Working with methods.</h3>
+
+<p>I couldn't think of anything else other than patching the <code>Symbol</code> module and overloading <code>+@</code>.</p>
+
+<pre><code>&gt;&gt; def sqr(x)
+&gt;&gt; x * x
+&gt;&gt; end
+
+&gt;&gt; def inc(x);
+&gt;&gt; x + 1
+&gt;&gt; end
+
+&gt;&gt; (+:sqr | +:inc)[5]
+=&gt; 26
+</code></pre>
+
+<p>You can mix methods and lambdas.</p>
+
+<pre><code>&gt;&gt; negate = lambda {|x| -x }
+&gt;&gt; (+:sqr | +:inc | negate)[5]
+=&gt; -26
+</code></pre>
+ </section>
+
+ </div>
+ <!--[if !IE]><script>fixScale(document);</script><!--<![endif]-->
+ </body>
+</html>
Oops, something went wrong.

0 comments on commit 46c811c

Please sign in to comment.