On 8 May 2011 17:55, john skaller <skal...@users.sourceforge.net> wrote: > > On 08/05/2011, at 10:31 PM, Rhythmic Fistman wrote: > >> You take a function f:a->b and wrap a up to get a new function with no >> arguments, like this: >> >> g:1->b? > > It's a closure, or a specialisation, or perhaps even a projection. > > Basically you're taking some domain a and a function > > k: c -> a > > and composing them: > > g (x) = f ( k (x) ) > > or just > > g = f . k (in forward notation) > > In your case you picked > > k: 1 -> a > > so the composition is g: 1 -> b
Ok, cool. So when I'm implementing such a thing in c++, what the hell do I call the class? Or classes, because I often derive these things from an abstract base class. I can't bring myself to call them "factories", but now I've got more creators than genesis. You must have some insight into this because you generate this stuff. class thing_that_returns_b : public things_that_return_b { a A; private: // pure virtual in things_that_return_b virtual b g() { // use a to create a b } }; > >> >> Is that 1 standard notation? > > In category theory, yes. 1 is "unit", a canonical type with 1 value. > In Felix that value is (), the empty tuple. In set theory, any set > > {x} > > is a unit (singleton). Note this is not the same as 0, aka void, > the type with NO values, or the empty set. In practice I don't see the difference. () seems like no values to me. ------------------------------------------------------------------------------ Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language