Why are you using D instead of Rust?
Antonio
antonio at abrevia.net
Sun Oct 24 20:57:45 UTC 2021
On Saturday, 23 October 2021 at 04:25:21 UTC, Dr Machine Code
wrote:
> Just would like to know you all opinions
Try to write this in Rust
```d
T[] sorted(T)(T[] xs) {
return xs.length == 0 ? [] :
xs[1..$].filter!(x=> x < xs[0]).array.sorted ~
xs[0..1] ~
xs[1..$].filter!(x=> x >= xs[0]).array.sorted;
void main() {
[1,6,2,3,1,9,3].sorted.writeln;
}
```
D is not Scala... but it is more expressive than Rust (Thanks to
UFCS, Ranges & GC).
More information about the Digitalmars-d
mailing list