2 ms·
JavaScript lets you do: a.map(x => x + 1) which is pretty nice. And Rust lets you do: a.map(|x| x + 1) C++ syntax is just awful, and especially for function
by nicoburns 8y ago
JavaScript lets you do:
a.map(x => x + 1)
which is pretty nice. And Rust lets you do:
a.map(|x| x + 1)
C++ syntax is just awful, and especially for functional stuff.
- himom 8y agoSwift closure syntax, at least in <= 2.0, made for awkward API calls, since it wasn’t clear whether inline or after closures were used. In Ruby, a.map(&:succ)
- steveklabnik 8y agoIf you have a named function, rust lets you do a.map(succ) as well, since functions can be used where closures can, as long as the types work.
- jeffmcmahan 8y agoSame in JS