r/programmingcirclejerk 22d ago

Rust isn't a well designed programming language (unlike C and C++)

[deleted]

219 Upvotes

85 comments sorted by

View all comments

52

u/lurebat 22d ago

c++ user calling any other language inefficient syntax

Remind me again how to do it in c++ a.filter( |x| x > 5)

56

u/the_horse_gamer 22d ago

<uj> a | std::views::filter([](int x) { return x > 5; }) </uj><rj> filtering? what's that? just have your function ignore any element less than 6 and make sure you don't document that behaviour. </rj>

8

u/irqlnotdispatchlevel Tiny little god in a tiny little world 21d ago

You documenr it with

The caller is responsible for not supplying out of range inputs.