A fellow student and I are writing a paper on functional programming for a progr
ID: 647543 • Letter: A
Question
A fellow student and I are writing a paper on functional programming for a programming languages course, part of which will be comparing and contrasting Lisp (Scheme), ML (SML), and Haskell. We'll be coding the same algorithm in each language and we're at a bit of a loss for exactly what to code. We would be grateful for some suggestions for algorithms that fit the bill (described below). We'll work out the code---we're just looking for suggestions. But if there's a particular tricky point or useful idiom we'd welcome a heads-up.
We envision the code being about a page. In particular, the professor wants something more substantial than a line or two. To the degree possible, we'd like to use this to contrast the styles of the three languages and at the same time showcase the benefits of functional programming. I considered quicksort, but the standard Haskell code is just a line or two.
I would have tagged this with "homework" and "soft question" (as well as "ML" and "Haskell"), but those tags don't seem to exist. Also, I wasn't sure whether Computer Science or Stack Overflow was the right place for this, but decided on Computer Science because we're not really looking for worked-out code or solutions to a particular coding problem. Instead we're looking to demonstrate the benefits of the functional programming paradigm and three important branches thereof.
Explanation / Answer
Project Euler has nice problems for showcasing the core of a programming language.
An important part of a programming language are user defined (container) data structures. Bread and butter containers include random access arrays, bidirectional lists, hash tables, and search trees. You may take the implementations from standard libraries of the languages to get interesting real world programs for you comparisons.
A strong point of functional programming languages is that they allow modular reuse of standard algorithms. The C++ stl header algorithm provides a nice collection of those reusable standard algorithms.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.