The document discusses functional programming concepts like recursion, higher-order functions, and combinators. It provides examples of using recursion to solve problems like calculating factorials and sorting arrays. It also discusses how concepts like tail-call elimination and garbage collection make recursion practical for modern languages. Resources for further studying functional programming patterns and concepts are provided.
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Dangers of Driving on Railroad Tracks
1. Don’t Drive on the
Railroad Tracks
Eugene Wallingford
University of Northern Iowa
November 17, 2010
Thursday, November 18, 2010
2. In the small, you know this.
It is no big deal.
In the large, this is different.
It changes how you think
about problems and data.
Two Claims
Thursday, November 18, 2010
39. # Python
for item in iterable_collection:
# do something with item
# Ruby
set.each do |item|
# do something with item
end
Thursday, November 18, 2010
67. A combinator is a function
that takes functions as input
and computes its result
by composing those functions. *
* and nothing else.
There are no free variables.
Thursday, November 18, 2010
68. combinator is to functional programming
as
framework is to object-oriented programming
Thursday, November 18, 2010
69. combinator is to functional programming
as
framework is to object-oriented programming
the next level of abstraction
Thursday, November 18, 2010
70. A Common Pattern...
widget.collection
.select { |a_table|
a_table.widgets_column_name =~ regex }
.map { |a_table|
widget.attribute_present?(a_table.widgets_column_name) &&
{ a_table.label
=> widget.send(a_table.widgets_column_name) }
|| {} }
.inject(&:merge)
Thursday, November 18, 2010
71. Combinators in Action
suppose we want to find
the square of the sum
of all the odd numbers
between 1 and 100
Thursday, November 18, 2010
103. If I had asked people
what they wanted,
they would have said
'faster horses'.
Henry Ford
Thursday, November 18, 2010
104. An invention has to make
sense in the world
in which it is finished,
not the world
in which it was started.
Ray Kurzweil
Thursday, November 18, 2010