From
CeePlusPlus:
"C++ = the "C" language, enhanced with
ObjectOriented and
FunctionalProgramming concepts."
Can anybody give examples how
CeePlusPlus has support for
FunctionalProgramming? The Y combinator in C++ would be nice... --
StephanHouben
This web site is one of several which describe libraries for function programming in C++:
http://www.cc.gatech.edu/~yannis/fc++/. The authors give the library the name
Functional Programming in C++, which makes it hard to invent a wiki name for it, as the obvious one is taken.
FunctoidsInCpp is going to have to do. There is also the
BoostPhoenixLibrary which is one of the
BoostLibraries. --
JohnFletcher
November 2010 See
CppNext for lively discussion of functional programming in C++.
It has support for currying (
CurryingSchonfinkelling) using the binders binder1st and binder2nd. I.e., you can construct a unary_function by taking a binary_function and binding one of its args to a fixed value. More details can follow if you're interested... Is this the kind of thing the questioner meant?
Yes it is: BTW this sounds like partial application, not currying. In SchemeLanguage I can do:
(define (apply-partial proc . arglist1)
(lambda arglist2
(apply proc (append arglist1 arglist2))))
How would one define something similar to apply-partial in C++? -- sh
C++ provides the following
FunctionalProgramming tools and techniques:
BTW, there is
InteLib which provides
LispProgramming within C++ (actually, it is a kind of
LispProgramming without Lisp). However, being the author of it, I still do not consider that
CeePlusPlus is a
FunctionalProgramming language. I'd rather consider it an algebraic language which allows almost any
ProgrammingParadigm to be imported into. --
AndreyStolyarov
In the 2004
IcfpProgrammingContest (
http://www.cis.upenn.edu/proj/plclub/contest//results.php#languages), there were more C++ entries (25) than entries in any other individual programming language. (In other words, C++ had a
plurality--not a majority). In addition, Java was 4th (21 entries), Python 6th (16 entries),
CeeLanguage 7th (15 entries), and
PerlLanguage 9th (11 entries).
Among traditional function languages we find O'Caml 2nd (24 entries), Haskell 5th (20 entries), Lisp 8th (12 entries), and
SchemeLanguage 10th (9 entries). The
EmFour preprocessor (which is
TuringComplete) had more entries (2) than did
ErlangLanguage,
SmalltalkLanguage,
ToolCommandLanguage, bash, and a bunch of other languages.
What's that all mean? Not much, other than a primitive indicator of geek mindshare. It's interesting how much
TemplateMetaprogramming has rekindled interest in C++, especially when you consider what a royal pain C++ templates are to work with sometimes (especially when you are doing anything more complicated than simple abstraction over types).
See also
FunctionalProgrammingLanguage
CategoryCpp CategoryFunctionalProgramming