News for hackers. Stuff that matters.
Re:8 months of OCaml after 8 years of Haskell in production ... by bmitc on Tuesday December 03, 2024 @01:22PM (#42309365)
If I am understanding that |x| 2 * x in Rust is an anonymous function, another F# equivalent is fun x -> 2 * x.
Re:8 months of OCaml after 8 years of Haskell in production ... by neonsunset on Tuesday December 03, 2024 @01:38PM (#42309596)
The Haskell and F# examples above use partial application.

This also works:

  let zeroCount = numbers |> Seq.filter ((=) 0) |> Seq.length
Re:8 months of OCaml after 8 years of Haskell in production ... by steveklabnik on Tuesday December 03, 2024 @06:21PM (#42312810)
It'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.