Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

function composition with reverse syntax

If I want to apply f first and g second, I have to write:

g . f 

Is there another standard syntax that would allow me to write the functions in the reverse order?

f <whatever> g 

I know I can just invent my own syntax:

compose f g x = g (f x) 

and then use it like this:

f `compose` g 

But I would rather use a standard library facility.

like image 553
fredoverflow Avatar asked Aug 26 '11 17:08

fredoverflow


People also ask

What is the inverse of a composite function?

The inverse composition rulef ( g ( x ) ) = x f(g(x))=x f(g(x))=xf, left parenthesis, g, left parenthesis, x, right parenthesis, right parenthesis, equals, x for all x in the domain of g.

What happens when you take the composition of a function and its inverse?

The composition operator (○) indicates that we should substitute one function into another. In other words, (f○g)(x)=f(g(x)) indicates that we substitute g(x) into f(x). If two functions are inverses, then each will reverse the effect of the other.

What is the composition of F and G?

The composition of two functions g and f is the new function we get by performing f first, and then performing g. For example, if we let f be the function given by f(x) = x2 and let g be the function given by g(x) = x + 3, then the composition of g with f is called gf and is worked out as gf(x) = g(f(x)) .

What is composition of a function?

In Maths, the composition of a function is an operation where two functions say f and g generate a new function say h in such a way that h(x) = g(f(x)). It means here function g is applied to the function of x. So, basically, a function is applied to the result of another function.


1 Answers

f >>> g from Control.Arrow.

like image 73
Josh Lee Avatar answered Oct 12 '22 00:10

Josh Lee