3 ms·
The other killer features that you missed are - computation expressions [0], which can be used to easily create a DSL (domain specific language) so you can def
by eyegor 5y ago
The other killer features that you missed are
- computation expressions [0], which can be used to easily create a DSL (domain specific language) so you can define workflows and keywords to abstract big business logic
- currying [1] and partial application, which lets you call functions with incomplete parameters and pipe along the new function. It's like a much more flexible version of Func<t,..> in a C# method parameter.
Once you get comfortable with these, you'll find yourself using them all over.
If you have any specific questions I can probably answer them, one of the projects I lead at work has ~500kloc of F# which interops with C# and unmanaged languages. The largest value-add for us is probably the units of measure though, since the domain involves a lot of physics.
[0] https://fsharpforfunandprofit.com/posts/computation-expressions-intro/ https://fsharpforfunandprofit.com/posts/computation-expressi...
[1] https://fsharpforfunandprofit.com/posts/currying/ https://fsharpforfunandprofit.com/posts/currying/
- Ntrails 5y agoCurrying honestly feels like a source of pain as a dabbler. I often encounter complex function signatures that I find very hard to grok at all.
- WastingMyTime89 5y agoI think that's one of the difficulty which is hard to understand for people used to it which is why it might be hard to find material explaining it to you as you would like. As someone who was taught programming with Ocaml as my first real language, I find currying intuitive (the rightmost type is the result, everything else is an argument) but sometimes I have difficulty with functions taking other functions as arguments and which are suffisently complex for their comportement to not be obvious from their type signature. But that's inherent complexity not really a problem with currying.
- Ntrails 5y agoI don't know, I think once you're passing in results from functions rather than functions themselves to curry, the complexity is not centralised in the same way, but broken down. It's a bit like occasionally needing to create intermediate variables to grok precisely what is being made at a specific point in highly chained code (I do this occasionally in LINQ too). My brain is only small and cannot keep track of things clearly