Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Restructuring, wrote chapter 1

  • Loading branch information...
commit 3db1529b4199e9512e60ae72b3dc30d06d446592 1 parent 9510463
Michael Kohl authored November 13, 2009
10  functional-ruby.bib
@@ -2,10 +2,18 @@ @misc{ wiki
2 2
   author = "Wikipedia",
3 3
   title = "Functional {P}rogramming --- {W}ikipedia{,} {T}he {F}ree {E}ncyclopedia",
4 4
   year = "2009",
5  
-  url = "\url{http://en.wikipedia.org/w/index.php?title=Functional_programming&oldid=317124047}",
  5
+  url = "\url{http://en.wikipedia.org/wiki/Functional_programming}",
6 6
   note = "[Online; accessed 5-October-2009]"
7 7
 }
8 8
 
  9
+@misc{ wiki-lambda,
  10
+  author = "Wikipedia",
  11
+  title = "Lambda {C}alculus",
  12
+  year = "2009",
  13
+  url = "\url{http://en.wikipedia.org/wiki/Lambda_calculus}",
  14
+  note = "[Online; accessed 13-October-2009]"
  15
+  }
  16
+
9 17
 @misc{ video-wampler,
10 18
   author = "Dean Wampler",
11 19
   title = "Better {R}uby through {F}unctional {P}rogramming",
69  functional-ruby.tex
... ...
@@ -1,7 +1,7 @@
1 1
 %
2 2
 %  Functional Programming in Ruby
3 3
 %
4  
-%  Created by Michael Kohl on 2009-10-04.
  4
+%  Created by Michael Kohl on 2009-11-13.
5 5
 %
6 6
 %  Copyright (c) 2009 Michael Kohl. 
7 7
 %  Licensed under the Creative Commons 
@@ -40,7 +40,7 @@
40 40
 \title{Functional Programming in Ruby} 
41 41
 \author{Michael Kohl}
42 42
 
43  
-\date{2009-11-02}
  43
+\date{2009-11-13}
44 44
 
45 45
 \begin{document}
46 46
 
@@ -50,10 +50,24 @@
50 50
 \tableofcontents
51 51
 
52 52
 \chapter{About this eBook}
  53
+In recent years functional programming languages \cite{wiki} managed to somewhat overcome the prejudice of only being used in - and by - academics and managed to attract a wider audience. A lot of people attribute this recent success to the ubiquitous presence of multicore systems, leading to an increased need in concurrent software designs, an area where functional programming languages excel. 
53 54
 
54  
-\paragraph{Acknowledgements}
  55
+Whatever the reasons really are, it seems functional languages are slowly arriving in the programming mainstream, and even though Ruby per se isn't one of them, it provides enough concepts to incorporate a functional-like style into your programs. 
55 56
 
56  
-\paragraph{Support}
  57
+This eBook tries to give a brief overview of functional programming and the functional features of Ruby. It will by definition always be a work in progress, so if you have any corrections or additions, please head over to
  58
+\begin{center}\url{http://github.com/citizen428/fp-ruby-ebook}\end{center}
  59
+
  60
+fork and send me a pull request!
  61
+
  62
+\paragraph{Acknowledgements}$\;$\\
  63
+\\
  64
+The contents of this eBook are heavily based on Dean Wampler's RubyConf 2008 talk \cite{video-wampler}, as well as Tom Stuart's presentation at the London RUG meeting \cite{video-stuart} and the accompanying slides \cite{pdf-stuart}.
  65
+
  66
+I also want to thank my colleagues at \href{http://rubylearning.org}{RubyLearning.org} for always keeping me on my toes and constantly proving how much fun programming in Ruby can be. 
  67
+
  68
+\paragraph{Support}$\;$\\
  69
+\\
  70
+\includegraphics{pledgie.png}
57 71
 
58 72
 \paragraph{License}$\;$\\
59 73
 \\
@@ -62,40 +76,42 @@ \chapter{About this eBook}
62 76
 \chapter{Functional Programming}
63 77
 
64 78
 \section{What is Functional Programming?}
65  
-intro - was ist FP? lambda calculus
66  
-mathematical definition of functions
67  
--> immutabilty
68  
-\cite{wiki}
69  
-functions as first class citizens
70  
-compose - return, assign
71 79
 
72  
-side-effect free
73  
--> don't change state (easier to understand, concurrency)
  80
+\subsection{Lambda Calculus}
  81
+
  82
+\cite{wiki-lambda}
  83
+
  84
+\section{Important Concepts} 
  85
+
  86
+\subsection{Mathematical Functions}
74 87
 
75  
-recursion
  88
+also composition and partial application
76 89
 
77  
-currying
  90
+\subsection{Higher-order Functions}
78 91
 
79  
-pattern matching 
  92
+\subsection{Immutability}
80 93
 
81  
-lazyness
  94
+\subsection{Lazyness}
  95
+
  96
+\subsection{Recursion}
82 97
 
83 98
 \section{Advantages of Functional Programming} 
84 99
 concurrency easier (no locking, no synchronization, no-side effects)
  100
+terser code
  101
+easier to debug
85 102
 
86 103
 \section{Functional Programming Languages} 
87  
-funktionale sprachen - uebersicht, kurze vorstellung, plus unterschied pure/impure und lazy/non-lazy
  104
+pure vs impure
88 105
 
89  
-languages: ML, Haskell, Erlang, F\#, Clojure...
  106
+statically typed, pattern matching, code not data: ml family, ocaml, haskell
90 107
 
91  
-multiparadigm: Common Lisp, Scheme, but also Ruby and Python...
  108
+dynamically typed, homoiconic, lists: cl, scheme, clojure
92 109
 
93  
-\section{Important Concepts} 
94  
-Referential transparency Higher-order functions Pure functions Recursion
  110
+languages: ML, Haskell, Erlang, F\#, Clojure...
95 111
 
96 112
 \chapter{FP in Ruby}
97 113
 
98  
-\section{Functional "classics"}
  114
+\section{The Enumerable Module}
99 115
 
100 116
 The first taste many people get of FP programming are the functions map, fold, find and zip (note: names vary between languages). Here is a list of their Ruby equivalents:
101 117
 
@@ -137,17 +153,18 @@ \section{Functional "classics"}
137 153
 \end{lstlisting}
138 154
 \end{itemize}
139 155
 
140  
-immutability - read-only attributes, clone and freeze, no bang methods
  156
+\section{Immutability}
  157
+read-only attributes, clone and freeze, no bang methods
141 158
 
142  
-first class functions - blocks, lambdas, procs
  159
+\section{Higher-order Functions}
  160
+blocks, lambdas, procs
143 161
 
  162
+\section{Avoid side-effects}
144 163
 side-effect free methods - attr\_readers, filter, select
145  
-
146 164
 return new objects from within methods
147 165
 
148 166
 \bibliographystyle{plain} 
149 167
 \addcontentsline{toc}{chapter}{Bibliography}
150 168
 \bibliography{functional-ruby}
151 169
 
152  
-
153 170
 \end{document} 
BIN  pledgie.png

0 notes on commit 3db1529

Please sign in to comment.
Something went wrong with that request. Please try again.