3 ms·
F# is a cleaner example of putting data first.
by nojito 6y ago
F# is a cleaner example of putting data first.
- klibertp 6y agoYes; I didn't mention it because, while they are technically literals, you are expected to write your own types and use your own constructors. But yes, F#, OCaml, Haskell, Idris, Elm, etc. are also very data-centric.
- CraigJPerry 6y agoDoes F# not put types first and data second? Would it be idiomatic to do clojure style maps where the map keys end up being treated like pure functions that return a value.
- jolux 6y ago>Does F# not put types first and data second? The F# and ML view of the world is, roughly, that data and types are not separable in any way that's useful. Types are just how programmers make sense of data, and they exist in every language. The difference is whether or not the compiler will use them to help you make sense of your data as well, or whether you have to do your own manual type-checking. As for programming with maps the way it's done in Clojure, I would say generally no, that's not idiomatic F#, and it's a big blind spot for F#. OCaml has row polymorphic records, which would be a better fit for the treat-everything-as-a-map style of programming in a static language.