On Monday, 29 January 2024 at 19:24:51 UTC, Inkrementator wrote:
On Thursday, 25 January 2024 at 18:44:26 UTC, atzensepp wrote:
However this works:
```d
int delegate (int) td = (x) =>
compose!(f,g,g,f,g,g,f,g,g,f)(x);
```
While not a real function pointer, this might already fit your
On Thursday, 25 January 2024 at 18:44:26 UTC, atzensepp wrote:
However this works:
```d
int delegate (int) td = (x) =>
compose!(f,g,g,f,g,g,f,g,g,f)(x);
```
While not a real function pointer, this might already fit your
needs.
```d
alias td = compose!(f,g);
```
On Thursday, 25 January 2024 at 12:19:47 UTC, Paul Backus wrote:
On Thursday, 25 January 2024 at 08:25:02 UTC, atzensepp wrote:
```d
int function(int) t = compose!(f,g,g,f,g,g,f,g,g,f);
```
This leads to:
```
gdc lambda4.d
lambda4.d:28:25: error: template compose(E)(E a) has no value
int
On Thursday, 25 January 2024 at 08:25:02 UTC, atzensepp wrote:
```d
int function(int) t = compose!(f,g,g,f,g,g,f,g,g,f);
```
This leads to:
```
gdc lambda4.d
lambda4.d:28:25: error: template compose(E)(E a) has no value
int function(int) t = compose!(f,g,g,f,g,g,f,g,g,f);
```
Try using
On Wednesday, 24 January 2024 at 21:34:26 UTC, user1234 wrote:
On Wednesday, 24 January 2024 at 21:30:23 UTC, user1234 wrote:
On Wednesday, 24 January 2024 at 21:12:20 UTC, atzensepp wrote:
[...]
what a bummer!
Have you tried
https://dlang.org/phobos/std_functional.html#compose ?
Well
On Wednesday, 24 January 2024 at 21:30:23 UTC, user1234 wrote:
On Wednesday, 24 January 2024 at 21:12:20 UTC, atzensepp wrote:
[...]
what a bummer!
Have you tried
https://dlang.org/phobos/std_functional.html#compose ?
Well this violates the second requirement:
the composition itself
On Wednesday, 24 January 2024 at 21:12:20 UTC, atzensepp wrote:
[...]
what a bummer!
Have you tried
https://dlang.org/phobos/std_functional.html#compose ?
Some progress: compose function needs to know type but templates
help to create for different types.
```d
import std.stdio;
import std.container.array;
// Function composition:
int f(int x) { return x*2;} ;
int g(int x) { return x+2;} ;
double ff(double x) { return x*x;} ;
double gg(double