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 requi
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 x
On Wednesday, 24 January 2024 at 09:28:57 UTC, Renato wrote:
If you have "widespread" arithmetics which may overflow,
something like https://dlang.org/phobos/core_checkedint.html is
useful, yes, but in this case it's overkill.
To make use of this, one needs to already anticipate an
arithmetic
On Wednesday, 24 January 2024 at 00:34:19 UTC, bachmeier wrote:
On Tuesday, 23 January 2024 at 21:40:46 UTC, Renato wrote:
While I can understand your frustration, it seems to me D is
not to blame in this instance because the code is quite
patently using unsafe constructs (D does not claim to
How is it possible to compose functions?
I came up with following solution that is not satisfactory
for two reasons:
1. the compose function should be argument agnostic
here it is explicitly coded for (int) -> (int)
2. the composition itself requires additional lambda
exp