Home | Libraries | People | FAQ | More |
Copyright © 2000-2003 Brian McNamara and Yannis Smaragdakis
Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Table of Contents
FC++ is a library for doing functional programming in C++. The library provides a general framework to support various functional programming aspects, such as higher-order[1] polymorphic[2] functions, currying, lazy evaluation, and lambda. In addition to the framework, FC++ also provides a large library of useful functions and data types.
In FC++, we program with functoids, which are C++ classes or structs which overload operator() and obey certain other conventions. We will describe functoids in more detail in Section 5, Section 6, and Section 7. Functoids are simply our chosen representation for functions in C++; for now you may equate the terms "functoid" and "function" in your mind. Later we shall see what exactly a functoid is and why it is useful.
This document describes "Boost FC++". Prior to being "boostified", FC++ existed as a research project at Georgia Tech for a number of years [FC++]. This is the first document to describe the boostified version of FC++. It is important to note the changes made to the library between "FC++" and "Boost FC++", in order to understand the old documentation. The changes are mostly just a matter of naming conventions. In Table 1, we summarize the naming changes from FC++ to Boost FC++, by giving a sense of the general name changes as well as some particular examples. To avoid confusion, the reader of this document should at least be aware of this mapping before reading any of the prior documentation on FC++.
Table 1. Naming changes from FC++ to Boost FC++
Original FC++ | Boost FC++ | Example (orig) | Example (Boost) |
---|---|---|---|
SomeFunctoid | some_functoid_type | EnumFrom | enum_from_type |
someFunctoid | some_functoid | enumFrom | enum_from |
SomeType | some_type | Full2 | full2 |
SomeFunc_ | some_func_x_type | BindM_ | bind_m_x_type |
NestedType | nested_type | Arg1Type | arg1_type |
Misc | Misc | RT,LAM,COMP,... | unchanged |
Misc | Misc | ElementType,LEType,Inv,Var | value_type,LE,INV,VAR |
Misc | Misc | Ref,IRef | boost::shared_ptr, boost::intrusive_ptr |
Misc | Misc | curryN | thunkN |
The only other major change to the library is that now the fun_type class only takes one argument (the result type). That is, code which used to say
template <class X, class Y> struct sig : public fun_type<X,Y,Something> {};now reads
template <class X, class Y> struct sig : public fun_type<Something> {};See Section 5 for details.
[FC++] The FC++ web page.
[Haskell] Haskell 98 Language Report.
[Jär&Pow03] The Lambda Library: unnamed functions in C++. Software: Practice and Experience . March, 2003.
[Jär&Pow01] The Lambda Library: Lambda Abstraction in C++. October, 2001. Workshop on C++ Template Programming. 2. Tampa, Florida. .
[McN&Sma to appear] Functional Programming with the FC++ library. Journal of Functional Programming. to appear. Available from the FC++ web site.
[McN&Sma00] Static Interfaces in C++. October, 2000. Workshop on C++ Template Programming. 1. Erfurt, Germany. .
[McN&Sma03] August, 2003. DPCOOL. 1. Uppsala, Sweden. . Syntax sugar for FC++: lambda, infix, monads, and more. Available at the FC++ web site .
[Sie&Lum00] Concept Checking: Binding Parametric Polymorphism in C++. October, 2000. Workshop on C++ Template Programming. 1. Erfurt, Germany. .
[Sma&McN02] FC++: Functional Tools for Object-Oriented Tasks. Software: Practice and Experience . August, 2002. A previous version of this paper is available from the FC++ web site.
[ReturnType] A uniform method for computing function object return types. Available at http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1454.html .
[1] A higher-order function is a function which takes another function as an argument or returns a function as a result.
[2] We use the term "polymorphism" to mean parametric polymorphism (e.g. templates). This is the usual definition in the sphere of functional programming. In object-oriented programming, the term "polymorphism" usually refers to dynamic dispatch (virtual function call). Please note the definition we are using. In contrast, a monomorphic function is a function which only works on one set of argument types.
Last revised: October 03, 2003 at 23:27:22 GMT |