Cambridge Journals Online

Cambridge Journals Online
Skip to content
Journal of Functional Programming (2004), 14 : 429-472 Cambridge University Press
Copyright © 2004 Cambridge University Press
doi:10.1017/S0956796803004969
Published online by Cambridge University Press 07 Jun 2004


Article

Functional programming with the FC++ library


BRIAN MCNAMARA a1 and YANNIS SMARAGDAKIS a1
a1 College of Computing, Georgia Institute of Technology, GA, USA, 801 Atlantic Dr. Atlanta, GA 30332-0280

Article author query
mcnamara b   [Google Scholar
smaragdakis y   [Google Scholar
 

Abstract

We describe the FC++ library, a rich library supporting functional programming in C++. Prior approaches to encoding higher order functions in C++ have suffered with respect to polymorphic functions from either lack of expressiveness or high complexity. In contrast, FC++ offers full and concise support for higher-order polymorphic functions through a novel use of C++ type inference. The FC++ library has a number of useful features, including a generalized mechanism to implement currying in C++, a “lazy list” class which enables the creation of “infinite data structures”, a subtype polymorphism facility, and an extensive library of useful functions, including a large part of the Haskell Standard Prelude. The FC++ library has an efficient implementation. We show the results of a number of experiments which demonstrate the value of optimizations we have implemented. These optimizations have improved the run-time performance by about an order of magnitude for some benchmark programs that make heavy use of FC++ lazy lists. We also make an informal performance comparison with similar programs written in Haskell.



back to top
Cambridge University Press