I'm going to use an exemple to ask my question, lets suppose we have a function G composed of 3 functions f1, f2 and f3, like this picture :
the function
G = f3(f2(f1(input))) or g = f3 º f2 º f1
an other example when G is composed of 4 functions like so : where f1 and f2 are not necessarily parallel, how can we write G?
Asked
Active
Viewed 99 times
0

Balkis
- 103
- 7
-
in second example f2 does not have input, can it be simplified to constant argument to f3? – Nazarii Bardiuk Sep 14 '16 at 10:33
-
I forgot to draw it , it does have an input, i have edited the question – Balkis Sep 14 '16 at 10:39
-
3in the first image the arrow from f1 to f2 is easy, but why are there 2 arrows from f2 to f3? If in the first picture f1 takes as argument **input** and serves itselfe as input for f2 which serves as input for f3, you cold write your function g in image #2 as: `G = f4(f3(f1(input, f2(input))))` – Radinator Sep 14 '16 at 10:49
-
3How do you define "not necessarily parallel" in mathematical terms? Ignoring this constraint I would write: G = f4 º f3 º (f1 x f2) – Peter G. Sep 14 '16 at 10:49
-
1@Radinator the 2 arrows means the output is a tuple or in this case a couple – Balkis Sep 14 '16 at 10:52
-
Okay @PeterG., exactly i'm not sure how, if they where parallel i think it should be like this : G = f4 º f3 º (f1 , f2), not parallel i suppose like you suggested – Balkis Sep 14 '16 at 10:54
1 Answers
2
You will want to have a look at arrows. With them, your functions could be expressed as follows:
G1 = f1 >>> f2 >>> f3
G2 = (f1 *** f2) >>> f3 >>> f4
Notice that there is no difference between one and two lines between two function blocks - two arguments is equivalent to one tuple argument. It only will matter if the lines point to different blocks.

Bergi
- 630,263
- 148
- 957
- 1,375