![]() |
Home | Libraries | People | FAQ | More |
In functional programming languages, combinator functions take functions as arguments, and produce new functions with related capabilities. For example in the following pseudo code:
f2 = twice(sin)
twice returns a function
that applies the argument function twice. So for all x
f2(x) == sin(sin(x))
In C++ a combinator typically takes some callable type(s) as arguments, and returns a function object providing some new functionality.
For the purposes of the Traversal Library we define hierarchical data structures
as types built out of other types. For example a std::pair<int,char> is
a hierarchical data structure built from the types int
and char. A more complex structure
could then be built from this type, for example std::vector<std::pair<int,
char>
>, and so on and so on. Arbitrarily
complex types can be built up in this way, forming into a natural hierarchy.
C++, the STL and Boost provide a rich collection of tools for building up
such types, such as structs,
pairs, Boost.Variant, Boost.Optional,
pointer and smart pointer types, etc. etc.
| Copyright © 2007 -2008 Dan Marsden |