3 ms·
Rust unfortunately has that whole H. R. Giger syntax about it, though. things.into_iter().skip(1).each(|wtf| { are_you_kidding(wtf) })? Compared to a more r
by tmtvl 4y ago
Rust unfortunately has that whole H. R. Giger syntax about it, though.
things.into_iter().skip(1).each(|wtf| { are_you_kidding(wtf) })?
Compared to a more reasonable language, like, say, Perl:
map { do_something($ARG) } @things[1..$#things];
- zozbot234 4y ago"Perl" and "more reasonable language" don't belong together. It's a complete oxymoron. The Rust syntax is entirely compositional, other than the || delimiters (which introduce a fresh binding to the subsequent block), and the ? which involves abnormal control flow.
- masklinn 4y agoI assume GP posted ironically because the Rust snippet is mostly pretty bland function and method calls, the only weird-ish bits are the postfix "?" (which have become very common[0]) and the block syntax[1], while they're using 3 different sigils in a Perl snippet I'm not even sure makes sense (though it's probably valid because perl) e.g. from what little I've retained of perl (against my will) "@ARG" is an array with the command line arguments, $ARG does not exist, this just passes `undef` repeatedly to `do_something`. [0] https://en.wikipedia.org/wiki/Safe_navigation_operator https://en.wikipedia.org/wiki/Safe_navigation_operator [1] e.g. it doesn't have let..else, macros, raw-idents, complicated type signatures, turbofishes, ... which could make the code a lot weirder
- tmtvl 4y ago$ARG does not exist If you read the perlvar perldoc (perldoc perlvar or https://perldoc.perl.org/perlvar https://perldoc.perl.org/perlvar), you will see it is the English form of $_. You just need to: use English;