The library now compiles with the "-pedantic -ansi" options for g++, which means it will probably compile with more other compilers now, too. The previous release had a number of "typename" problems; C++ requires the "typename" keyword to appear in lots of places inside templates.
minus(3,2); // yields 1 minus(3); // yields a new function f, where f(x) = 3-x minus(3,_); // same as above minus(_,2); // yields a new function f, where f(x) = x-2This is accomplished by the
CurryableN
classes, which
serve as wrappers around normal functions. The function
makeCurryable()
turns an uncurryable function into an
automatically curryable version. See http://www.cs.umass.edu/~yannis/fc++/currying.html
for more info.fcpp
. However, bugs in the g++2.95.2 compiler force us to keep
part of the library in the global namespace. If you have a working
compiler, use the compiler option -DFCPP_USE_NAMESPACE to have the whole
library be in the namespace. There's a
using namespace fcpp;at the bottom of
prelude.h
, which dumps it all
into the global namespace anyway. We've done that for backwards
compatibility (you can drop in the new library and your old code should
still work without changes), but feel free to remove it (we certainly
will, in a future revision).FunN
s). For example,
Fun1<int,int,int> f = fcpp::plus; Fun1<double,double,double> g = fcpp::plus;both "do the right thing".
ptr_to_fun()
, monomorphizeN()
,
CurryableN
, etc.) work for all sets of functions with 0-3
arguments. (Previous versions of FC++ had spotty support.)List
class has been completely re-implemented.
The old version had a number of problems (the major ones being that (1)
it was too eager (not lazy enough) in a number of cases, and (2) that
functions like cons
had un-intuitive interfaces) that have
now been solved. In our limited tests, the new List
seems
to perform comparably with the old, but let us know if you notice a
speed difference.List::WrappedType
has been renamed to
List::ElementType
. The new name makes more sense,
especially in papers/tutorials.list_until
has been renamed
listUntil
(consistent with
naming convention of other list functions).