3 ms·
let (word, len, ones) = (0, 0, 0) looks like a cleaner version that works in F# (and I am not sure in Rust). This is extremely useful when initializing values
by sremani 11y ago
let (word, len, ones) = (0, 0, 0)
looks like a cleaner version that works in F# (and I am not sure in Rust). This is extremely useful when initializing values from a function that returns a tuple and do not want to change them (unlike the mut word etc.)
let (x, y, z) = GetStartPoint3d()
- steveklabnik 11y agoThat works in Rust if you add a ; on the end.
- sremani 11y agoNice. The original article does an interesting job, but what truly blows my mind is Rust gives systems level of performance while supporting highorder functions and aspects of functional programming. That is truly remarkable. On the side note, adding the ; on the end also works in F# but is not idiomatic.
- steveklabnik 11y agoYeah, the optimizations are pretty great. I really love our closures too, it enables all kinds of good stuff. (And thanks for the idiom note, makes sense. F# is pretty cool.)