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.
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.
In Ruby,
a.map(&:succ) a.map(succ)
as well, since functions can be used where closures can, as long as the types work.