3 ms·
If I am understanding that |x| 2 * x in Rust is an anonymous function, another F# equivalent is fun x -> 2 * x.
by bmitc 2y ago
If I am understanding that |x| 2 * x in Rust is an anonymous function, another F# equivalent is fun x -> 2 * x.
- neonsunset 2y agoThe Haskell and F# examples above use partial application. This also works: let zeroCount = numbers |> Seq.filter ((=) 0) |> Seq.length
- steveklabnik 2y agoIt's a closure, not just an anonymous function, though it of course has an empty environment so it's not a significant difference in this case. Rust doesn't have syntax for anonymous functions, only closures.
- deleted 2y ago[deleted]