3 ms·
To be honest, I'd struggle to think of a language with generics or dynamic typing where you couldn't do function composition. Even in C, you could do something
by scaredginger 4y ago
To be honest, I'd struggle to think of a language with generics or dynamic typing where you couldn't do function composition.
Even in C, you could do something like in this godbolt link (ugly, I know):
https://godbolt.org/z/aKTz6fdbc https://godbolt.org/z/aKTz6fdbc
- spoiler 4y agoThat's not quite the same (functionally) as the Rust solution though? Unless you meant to just illustrate a minimal PoC, in that case I suppose it does the job. More importantly (IMO) Rust allows us to be truly generic without sacrificing any type safety in the process.