Title: Functional Programming in the CS Curriculum
1Functional Programming in the CS Curriculum
- Stuart Reges
- University of Washington
2The back story(how I ended up on this panel)
- We were in the middle of a heated debate in which
I almost wanted to strangle Matthias Felleisen
and Shriram Krishnamurthi
3The back story(how I ended up on this panel)
- We were in the middle of a heated debate in which
I almost wanted to strangle Matthias Felleisen
and Shriram Krishnamurthi - I said, I wish we could agree on something
simple, like asking the ACM to require functional
programming in the CS core
4The back story(how I ended up on this panel)
- We were in the middle of a heated debate in which
I almost wanted to strangle Matthias Felleisen
and Shriram Krishnamurthi - I said, I wish we could agree on something
simple, like asking the ACM to require functional
programming in the CS core - Matthias hugged me
5The back story(how I ended up on this panel)
- We were in the middle of a heated debate in which
I almost wanted to strangle Matthias Felleisen
and Shriram Krishnamurthi - I said, I wish we could agree on something
simple, like asking the ACM to require functional
programming in the CS core - Matthias hugged me
- Matthias, Shriram and I wrote a proposal
6The back story(how I ended up on this panel)
- We were in the middle of a heated debate in which
I almost wanted to strangle Matthias Felleisen
and Shriram Krishnamurthi - I said, I wish we could agree on something
simple, like asking the ACM to require functional
programming in the CS core - Matthias hugged me
- Matthias, Shriram and I wrote a proposal
- It was unanimously approved by 30 PL researchers
who rarely agree on anything
7The back story(how I ended up on this panel)
- We were in the middle of a heated debate in which
I almost wanted to strangle Matthias Felleisen
and Shriram Krishnamurthi - I said, I wish we could agree on something
simple, like asking the ACM to require functional
programming in the CS core - Matthias hugged me
- Matthias, Shriram and I wrote a proposal
- It was unanimously approved by 30 PL researchers
who rarely agree on anything - We all sang Kumbaya
8The back story(how I ended up on this panel)
- We were in the middle of a heated debate in which
I almost wanted to strangle Matthias Felleisen
and Shriram Krishnamurthi - I said, I wish we could agree on something
simple, like asking the ACM to require functional
programming in the CS core - Matthias hugged me
- Matthias, Shriram and I wrote a proposal
- It was unanimously approved by 30 PL researchers
who rarely agree on anything - We all sang Kumbaya (ok, that parts not true)
9What did we mean byfunctional programming?
10What did we mean byfunctional programming?
- I shall not today attempt further to define the
kinds of material I understand to be embraced
within that shorthand description and perhaps I
could never succeed in intelligibly doing so.
But I know it when I see it.
11What did we mean byfunctional programming?
- I shall not today attempt further to define the
kinds of material I understand to be embraced
within that shorthand description and perhaps I
could never succeed in intelligibly doing so.
But I know it when I see it. - Justice Potter Stewart on obscenity
12These are a few of myfunctional things
- Functions as first-class entities in a language
(e.g., can be passed as parameters) - Higher-order functions (map, filter, reduce)
- Avoidance of mutable state
- Closures (combination of code and context)
- Anonymous functions (lambdas)
- Use of lambda calculus for formal definitions
13An example from Pythoncompute primes less than
250
- def factors(n)
- return m for m in range(1, n1) if n m
0 - def is_prime(n)
- return factors(n) 1, n
- gtgtgt filter(is_prime, range(250))
- 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41,
43, 47, - 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103,
107, 109, - 113, 127, 131, 137, 139, 149, 151, 157, 163, 167,
173, 179, - 181, 191, 193, 197, 199, 211, 223, 227, 229, 233,
239, 241
14Why functional programming?
- FP stretches students understanding of what
programming means (what weve called paradigms
in the past) - FP constructs are showing up in many popular
programming languages (Python, Ruby, JavaScript,
OCaml) - FP is showing up in industry
- Microsoft F, LINQ
- Google MapReduce
- Yahoo Hadoop
- FP has a rich history dating back to Alonzo
Church (1936) and with significant interest ever
since (LISP-1958, ML-1973, Scheme-1975,
Erlang-1987, Haskell-1990)
15Our Proposal revenue neutral adjustment to CC2001
16Comments on FP10
- ACM has a comment period that ran from 6/9/08 to
7/16/08 - The FP10 proposal received the most comments
- Of the 135 people who commented, at least 130
were supportive
17Where do we stand now?
- The review committee was divided in its response
to the SIGPLAN proposal. On the positive side,
the committee was convinced that students need
exposure to more than one programming paradigm,
for precisely the reasons outlined in the
proposal. At the same time, there was no
consensus within the review committee that the
functional programming paradigm needed to be
required in all undergraduate computer science
curriculaWe did not believe that we could
justify making so far-reaching a change,
particularly at the level of an interim review.
Our consensus recommendation is therefore to add
a new requirement that students acquire facility
with more than one programming paradigmThe
review committee also plans to forward both the
SIGPLAN proposal and the notes from our
discussions to the next full-scale curriculum
committee.