Last update November 15, 2003

DWiki /
compose



Difference (last change) (no other diffs, normal page display)

Changed: 1c1,13
Describe the new page here.
A function that takes two functions and returns the composition of them. In mathematical notation (f o g) x = f(g(x))

Using /DeimosTemplateLibrary:

instance TFunctional(boolean, boolean, int) lambda;
boolean not(boolean b) { return !b;};
boolean negative(int n) { return n < 0;};
boolean() isNatural = lambda.compose(not, negative);


Obs.: This may work according to the kind of functions passed (e.g. closure or combinator) because of current implementation of /DynamicClosures.


(From DWiki)

A function that takes two functions and returns the composition of them. In mathematical notation (f o g) x = f(g(x))

Using /DeimosTemplateLibrary:

    instance TFunctional(boolean, boolean, int) lambda;
    boolean not(boolean b) { return !b;};
    boolean negative(int n) { return n < 0;};
    boolean() isNatural = lambda.compose(not, negative);

Obs.: This may work according to the kind of functions passed (e.g. closure or combinator) because of current implementation of /DynamicClosures.
(From DWiki)
FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: November 15, 2003 5:27 (diff))